uploadfile 安卓上传的问题?
发布于 5 年前 作者 na81 3446 次浏览 来自 官方Issues
wx.uploadFile({
     url: app.globalData.server + '/upload',
     filePath: imagePath,
     name: picname,
     success: function(res) {
       // console.log("图片上传成功:", res);
       if (res) {
         wx.showToast({
           title: '已提交发布!',
           duration: 3000
         });
         that.createNewOrder(picname);
       }
     }
   });

这是我上传图片的代码

ios设备使用正常,但是安卓设备上传的图片无法显示,对比了一下发现文件大小相差非常巨大

比较大的图片是ios设备提交,能正常显示.

小的文件是安卓上传的,无法显示.

请问如何解决,谢谢!

2 回复

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

我仔细研究了一下代码,好像不是uploadfile这个api出的问题,而是

that.data.ctx.draw(true, setTimeout(function () {
  wx.canvasToTempFilePath({
    canvasId: 'tempcv',
    success: function (res) {
      that.preview(res.tempFilePath);
      // that.uploadImageToServe(res.tempFilePath);
    },
  })
}, 5000));

这个代码出了问题,我预了res里的图片,ios下能正常生成图片,安卓真机下图片就是空白的

那么我现在是要另外再开个帖子问这个问题吗?

回到顶部