问题描述
我在堆栈溢出上搜索了所有已发布的问题/答案,但没有一个能解决我的问题
更新
问题的根源是http interceptor
jwt,当我评论它时它就起作用了。
有没有办法解决它?
TS
onSelectFile(files: File[]) {
if (files.length > 0) { this.file = files[0]; }
}
add(){
const uploadImageData = new FormData();
uploadImageData.append('file',this.file);
uploadImageData.append('user',JSON.stringify(this.user));
this.service.add(uploadImageData).subscribe(
data => {this.source=data },error => { console.log("erreur "); }
);
}
html
<div class="form-group col-md-3 col-lg-3 input-group-sm">
<label>Preuve d'achat</label><br>
<input type="file" (change)="onSelectFile($event.target.files)" enctype='multipart/form-data' >
</div>
后退
@PostMapping("/user")
public Object add(
@RequestParam("file")multipartfile file,@RequestParam("user")String user)
throws JsonParseException,org.codehaus.jackson.map.JsonMappingException,IOException {
...
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)