【发布时间】:2016-09-23 11:58:36
【问题描述】:
我已经创建了后端以使用它在 Postman 上工作的 post 方法获取文件。
但是从 angular2 前端它不起作用这是我所做的服务代码。
data1是图片数据
addData(postData: Image, data1:any): Observable<Team[]> {
console.log("team service");
this.image= postData;
let body = this.image;
let headers2= new Headers({ 'Content-Type': 'multipart/form-data' });
let options = new RequestOptions({ headers: headers });
return this.http.post(this.actionUrl, data1, options)
.map(this.extractData)
.catch(this.handleError);
}
报错:
POST http://localhost:8080/user/45646/userName/userPhoto 500(内部 服务器错误)500 - 内部服务器错误
【问题讨论】: