服务器报错:
org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/json
at org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:169)
怎么改都不行, 请问到底什么问题?
uni.uploadFile({ //huUploadImage
url: appendApi(obj.url),
header: appendHeader(obj.header),
files: obj.files,
success: (res) => {
// {"code":0,"message":"成功","data":[{"code":0,"filename":"upload/userInfo/1/C95C5769BD1CE9C98A95EBAD0E8B95F4.jpeg","message":"success"}]}
if (typeof (res.data) === "string") {
res.data = JSON.parse(res.data)
}
httpCallBackSuc(res, obj);
},
fail: (res) => {
httpCallBackFail(res, obj);
}
});
uni.chooseImage({
count: 1,
success: (chooseImageRes) => {
console.log(chooseImageRes);
huUploadImage({
files: chooseImageRes.tempFiles,
header: header,
suc: (res) => {
const dd = res.data[0];
if (dd.code == 0) {
Editor.insertEmbed(cursorLocation, "image", appendHost(dd.filename));
} else {
self.showOkDialog("错误", "上传错误,信息:" + res)
}
resetUploader();
}, fail: (err) => {
console.log(err);
self.showToastNoIcon("发生错误:" + err)
},
});
}
});