uni.uploadFile({
url: '',//接口
filePath: '',//要上传的图片的本地路径
name: 'file',
formData: {
// file: this.ImagetempFilePaths[index] //上传时额外参数,可不写
},
header: {
// "content-type": "multipart/form-data",
'token': token
},
success(res) {
console.log(res)
}
})
uniapp上传时切记"content-type": "multipart/form-data",要注释掉,否则回报服务器异常。