1

我的 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 });

};

我的风帆应用程序控制器中的代码是

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());
}

为什么我的 Angular 应用程序没有对 URL 发出请求?

4

0 回答 0