[英]Spring Boot + Angular file upload HTTP 417 error
在第一次上傳后上傳任何其他文件后,我得到HTTP-417錯誤和“我的Spring UploadController.java文件”中定義的“文件未上傳”消息。
Spring Boot + Angular文件上傳得到錯誤400錯誤請求
解決完上述查詢后,我遇到了錯誤417,以上查詢也包括了所有代碼集,包括我的Spring Controller文件以及Angular Component。
簡而言之,每次我只需要清除瀏覽歷史記錄和cookie即可再次成功上傳,每次只能上傳1個文檔。 對此一無所知。
當您嘗試上傳第二個文件時,必須重置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();
}
我希望它能解決您的問題!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.