uni.uploadFile({
header: {
'token': api.__CFG.TOKEN || '',
'content-type': 'multipart/form-data'
},
url: this.Setting.url,
filePath: data.fullPath,
name: 'file',
formData: formData,
success: res2 => {
console.log('888',res2)
// fs.unlinkSync(tempPath)
if (res2.statusCode === 200) {
const r_data = JSON.parse(res2.data)
if (r_data.error == 0) {
this.currentChunk++
if (this.currentChunk < this.chunks) {
this.loadNext()
} else {
r_data.md5value = datas.md5value
console.log('formData',datas)
this.callback(r_data)
}
} else {
this.callback(false)
}
} else {
this.callback(false)
}
},
fail: err => {
console.log('999',err)
this.callback(false)
}
})

- 发布:2025-02-20 11:38
- 更新:2025-02-21 11:53
- 阅读:40
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10
HBuilderX类型: 正式
HBuilderX版本号: 4.36
手机系统: Android
手机系统版本号: Android 15
手机厂商: vivo
手机机型: iqoo neo9spro+
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
按我上述操作
按我上述操作
预期结果:
能正常返回走进success而不是走到fail去
能正常返回走进success而不是走到fail去
实际结果:
大概率会走到fail去,但有时候又进success正常请求
大概率会走到fail去,但有时候又进success正常请求
bug描述:
目前只测试到安卓app中使用uni.uploadFile大部分会走fail 然后打印出来是uploadFile:fail undefined,但是有时候又可以正常上传,不知道怎么回事
