安卓uploadFile报错 MiniProgramError {"errMsg":"chooseImage:fail"} Object
-
ios可以,安卓上传报错,tarojs版本:3.1.0-beta.4
Taro.uploadFile({ url: url, //仅为示例,非真实的接口地址 filePath: file.url,//Taro组件返回的图片信息 header: { 'content-type': 'multipart/form-data'//上传文件的名称 }, name: params.key,//修改上传文件的名称 success(res) { if (res.statusCode === 200) { console.log(res) const result = JSON.parse(res.data) if (result.code != 0) { errorMsg(result.msg || "上传失败!") return } const resultData = result.data if (resultData.groupPhotoPath) { console.log(base + '/' + resultData.groupPhotoPath) self.setState({ groupPhoto: [{ url: baseImgViewPath + resultData.groupPhotoPath }], groupPhotoAddBtn: false }) } if (resultData.jobPhotoPath) { self.setState({ jobPhoto: [{ url: baseImgViewPath + resultData.jobPhotoPath }], jobPhotoAddBtn: false }) } if (resultData.incomePhotoPath) { self.setState({ incomePhoto: [{ url: baseImgViewPath + resultData.incomePhotoPath }], incomePhotoAddBtn: false }) } console.log(self.state) successMsg("上传成功!") } }, fail() { Taro.showToast({ title: '上传失败,请联系管理员', icon: 'none', duration: 2000 }) } })