我的app.component.html包含
<input type="file" ng2FileSelect [uploader]="uploader" #photoupload="ngModel" required id="photoupload" name="photo_upload" [(ngModel)]="personal.photo">
app.component.ts包含
this.uploader = new FileUploader({ url: "http://localhost:1337/api/fmng/create" });
this.uploader.onBeforeUploadItem = (item) => {
var formData = [{ "formdata" : this.personal }];
item.formData.push({ fileData: formData });
};
我的sails app控制器中的代码是
req.file('photo_upload').upload({ dirname: require('path').resolve(sails.config.appPath, 'assets/images') }, function (err, uploadedFiles) {
if (err) return res.serverError(err);
console.log('req all params ' + req.allParams());
}
为什么我的角度应用程序没有对URL进行请求?