伊豆
伊豆
  • 发布:2022-01-30 12:51
  • 更新:2022-01-30 13:04
  • 阅读:488

【报Bug】uni.uploadFile上传10MB左右的文件就没办法上传

分类:uni-app

产品分类: uniapp/H5

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: windows10

HBuilderX类型: 正式

HBuilderX版本号: 3.3.10

浏览器平台: 微信内置浏览器

浏览器版本: 公众号,微信版本8.0.19

项目创建方式: HBuilderX

示例代码:

/文件上传/
uploadFile: function(imgUrl, imgPath) {
// 返回promise
return new Promise((resolve, reject) => {
pub.doShowLog('####request file start param:',{url:imgUrl,data:imgPath});
uni.uploadFile({
url: imgUrl, // 后端api接口
filePath: imgPath, // uni.chooseImage函数调用后获取的本地文件路劲
name: 'file', //后端通过'file'获取上传的文件对象
success: res => {
res.data = JSON.parse(res.data);
pub.doShowLog('####request file end success:',{url:imgUrl,data:res});
checkRstSuccess(res);

                // 将结果抛出  
                resolve(res);  
            },  
            fail: function(err) {  
                pub.doShowLog('###end file fail reason:',{url:imgUrl,errorMsg:err},'error');  
                resolve(err);  
            },  
        });  
    });  
},

操作步骤:

/文件上传/
uploadFile: function(imgUrl, imgPath) {
// 返回promise
return new Promise((resolve, reject) => {
pub.doShowLog('####request file start param:',{url:imgUrl,data:imgPath});
uni.uploadFile({
url: imgUrl, // 后端api接口
filePath: imgPath, // uni.chooseImage函数调用后获取的本地文件路劲
name: 'file', //后端通过'file'获取上传的文件对象
success: res => {
res.data = JSON.parse(res.data);
pub.doShowLog('####request file end success:',{url:imgUrl,data:res});
checkRstSuccess(res);

                // 将结果抛出  
                resolve(res);  
            },  
            fail: function(err) {  
                pub.doShowLog('###end file fail reason:',{url:imgUrl,errorMsg:err},'error');  
                resolve(err);  
            },  
        });  
    });  
},

预期结果:

/文件上传/
uploadFile: function(imgUrl, imgPath) {
// 返回promise
return new Promise((resolve, reject) => {
pub.doShowLog('####request file start param:',{url:imgUrl,data:imgPath});
uni.uploadFile({
url: imgUrl, // 后端api接口
filePath: imgPath, // uni.chooseImage函数调用后获取的本地文件路劲
name: 'file', //后端通过'file'获取上传的文件对象
success: res => {
res.data = JSON.parse(res.data);
pub.doShowLog('####request file end success:',{url:imgUrl,data:res});
checkRstSuccess(res);

                // 将结果抛出  
                resolve(res);  
            },  
            fail: function(err) {  
                pub.doShowLog('###end file fail reason:',{url:imgUrl,errorMsg:err},'error');  
                resolve(err);  
            },  
        });  
    });  
},

实际结果:

文件十来MB时,就没有调用接口imgUrl

bug描述:

uni.uploadFile上传10MB左右的文件就没办法上传 ,传即使KB的就没问题

2022-01-30 12:51 负责人:无 分享
已邀请:
咳

额。。抓错误代码啊。

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