我有一个html格式的:
Choose File handleFileInput(files: FileList) {
const headers = new Headers({ 'Content-Type': 'multipart/form-data' });
var formData = new FormData();
formData.append("myFile", files.item[0]);
this.api.postWithoutEntity('/socialintegration/callback/attachment', { recipientId: this.selected.custSocId, file: formData }).subscribe();
this.upload = false;
}但是我得到了这个:当前请求不是多部分请求“
有什么建议吗?
发布于 2019-09-27 00:08:37
我不知道您的this.api.postWithoutEntity方法是如何工作的,但是您没有使用headers变量。您必须在请求时传递标头
const headers = new Headers({ 'Content-Type': 'multipart/form-data' });
return this.http.post<any>(
"/socialintegration/callback/attachment",
{recipientId: this.selected.custSocId, file: formData},
headers
);https://stackoverflow.com/questions/58120533
复制相似问题