uploadImage(){
let files=this.imageList.map((value,index)=>{
return{
name:'image'+index,
uri:value
}
});
console.log(files);
uni.uploadFile({
url: 'http://192.168.31.47:8088/app/fileUploads',
files:files,
filePath: '',
name: '',
formData: {
num:5
},
header: {
'content-type': 'multipart/form-data'
},
success: (res) => {
console.log(res);
}
});
}
后台是springboot 应该怎么接受这个files?
@RequestMapping(value = "/fileUploads", method = RequestMethod.POST)
public String fileUploads(HttpServletRequest request) throws Exception {
MultipartHttpServletRequest mulReq = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> map = mulReq.getFileMap();
return "1";
}
这个办法获取的map是空的
@RequestMapping(value = "/fileUploads", method = RequestMethod.POST)
public String fileUploads(MultipartFile[] file) throws Exception {
return "1";
}
这个办法的file也是空的
看文档上files应该是一个file对象数组 应该如何接受?
阿瑞
666、亲测可行
2021-04-09 10:59
2***@qq.com
兄弟牛逼!!!!!!!!!
2022-06-05 18:21