Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

苹果端偶尔上传不了。怎么回事?安卓端一直没问题 #63

Open
zonas1991 opened this issue May 7, 2019 · 6 comments
Open

Comments

@zonas1991
Copy link

苹果端偶尔上传不了。怎么回事?安卓端一直没问题

@gpake
Copy link
Owner

gpake commented May 8, 2019

报错是什么?

@zonas1991
Copy link
Author

zonas1991 commented May 8, 2019

奇就是奇在没报错,但就是没上传到七牛。安卓是一直上传没问题,苹果端就偶尔上传不到七牛。
上传代码如下:我没发现有什么错误呢~

initQiniu();
      var filePath = imgsrc[0];
      var img_info = "";
      if (filePath != null) {
        var fileName = filePath.split('//')[1];
        img_info = 'http://image.111111.com/' + fileName;
        // 交给七牛上传
        qiniuUploader.upload(filePath, (res) => {
          this.data.infoimg = img_info;
          this.data.place = place;
          console.log("上传封面成功");
          //提交至服务端
          wx.request({

            url: "http://localhost/api.php?do=post_child&openid=" + getApp().data.openid,
            method: "POST",
            header: { "content-type": "application/x-www-form-urlencoded" },
            data: this.data,
            complete: function (res) {
              that.setData({
                hidden: true
              })
              wx.showModal({
                title: '恭喜',
                content: '已提交成功!',
                showCancel: false,
                complete: function (res) {
                  wx.navigateTo({
                    url: '../index/index',
                  })
                }
              })
            }
          });
        }, (error) => {
          console.log("上传封面失败");
          sendpic = 1;
        });
      }

@zonas1991
Copy link
Author

还是说苹果拍出的照片比较质量大,所以超过多少M上传不了?但安卓好像拍出来质量更大哦~

@gpake
Copy link
Owner

gpake commented May 10, 2019

进行到哪一步卡住了呢?无论因为图片还是因为什么原因,都在 console 有错误提示,如果是卡在七牛上传,那就把返回的信息 log 出来。

@zonas1991
Copy link
Author

error: "bad token"。。额,就苹果偶尔会这样,安卓不会有

@gpake
Copy link
Owner

gpake commented May 12, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants