2***@qq.com
2***@qq.com
  • 发布:2021-07-15 15:33
  • 更新:2021-07-15 16:07
  • 阅读:355

uni-app用安卓原生定义的目录上传手机指定文件上传失败

分类:uni-app
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'  
                            });
2021-07-15 15:33 负责人:无 分享
已邀请:
DCloud_Android_DQQ

DCloud_Android_DQQ

没太看懂你的意思。你给个能复习问题的demo啊

  • 2***@qq.com (作者)

    我测试了一下,我用HBuilderX打包上传指定目录文件是可以的,但是放到离线打包就不行了

    2021-07-15 16:29

  • 2***@qq.com (作者)

    上面是我写的上传单个实例,如果我用HBuilderX真机运行测试上传不管多文件还是单文件都可以上传

    但是我用原生studio打包上传是不行的,有什么办法可以解决吗

    2021-07-15 16:35

该问题目前已经被锁定, 无法添加新回复