[英]Spring Boot + Angular file upload HTTP 417 error
After uploading any other file after 1st upload i am getting HTTP - 417 error and File Not uploaded message as defined under my Spring UploadController.java file. 在第一次上传后上传任何其他文件后,我得到HTTP-417错误和“我的Spring UploadController.java文件”中定义的“文件未上传”消息。
Spring Boot + Angular file upload getting error 400 bad request Spring Boot + Angular文件上传得到错误400错误请求
After resolving my above query i am facing error 417 my above query includes all set of codes too including my Spring Controller file plus my Angular Component too. 解决完上述查询后,我遇到了错误417,以上查询也包括了所有代码集,包括我的Spring Controller文件以及Angular Component。
In short at a moment able to upload only 1 document everytime i need to clear browsing history & cookies to upload successfully again. 简而言之,每次我只需要清除浏览历史记录和cookie即可再次成功上传,每次只能上传1个文档。 Wierd no idea of this. 对此一无所知。
You have to reset your formData when you try to upload second file. 当您尝试上传第二个文件时,必须重置formData。
public formdata = new FormData();
onSubmit() {
this.resetform(); //Order matters here
let headers: any = new Headers();
headers.append('Content-type', 'undefined');
formData.append("selectFile", this.formData);
const req5 = new HttpRequest('POST', 'url as hosted on TOMCAT', formData,
reportProgress: true,
responseType: 'text'
});
return this.httpClient.request(req5).subscribe(e => {(
console.log(e);
)}
}
resetform() {
this.formData = new FormData();
}
I hope it will solve your problem !!! 我希望它能解决您的问题!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.