that.uper = uni.uploadFile({
url: server_url + '/interfaceapi/upload/album_upload',
filePath: that.imgList[index].fullPath,
header: {
"x-access-token": LoginToken
},
formData: {
'facility_id': that.facility_detail.facility_id
},
name: 'album_url',
success: (res1) => {
var res = JSON.parse(res1.data);
if (res.status == 1 && res.code == 10000) {
uni.showToast({
title: '已上传云端相册!',
icon: 'none',
success: () => {
that.downProgressTips = '上传完成';
uni.hideLoading()
that.imgList.splice(index, 1)
that.swpier_id = 0
if (that.imgList.length == 0) {
uni.navigateBack({})
}
}
});
}
}
});
that.uper.onProgressUpdate(function(res) {
that.percent = res.progress;
that.totalBytesWritten = parseInt(Number(res.totalBytesSent) / 1024) + 'kb'
that.totalBytesExpectedToWrite = parseInt(Number(res.totalBytesExpectedToSend) / 1024) + 'kb'
});
2***@qq.com
- 发布:2021-07-15 15:33
- 更新:2021-07-15 16:07
- 阅读:432
2***@qq.com (作者)
我测试了一下,我用HBuilderX打包上传指定目录文件是可以的,但是放到离线打包就不行了
2021-07-15 16:29
2***@qq.com (作者)
上面是我写的上传单个实例,如果我用HBuilderX真机运行测试上传不管多文件还是单文件都可以上传
但是我用原生studio打包上传是不行的,有什么办法可以解决吗
2021-07-15 16:35