uploadFile接口是不是有问题?
发布于 6 年前 作者 weiding 3388 次浏览 来自 问答

uploadFile()接口代码之前能正常运行,突然一直报“uploadFile:fail exceed max upload connection count 1”错误 

//上传图片接口

  uploadDIY(filePaths, successUp, failUp, i, length, fparentid,fnumberList) {

    var that = this

    if (length > 0) {

      wx.uploadFile({

        url: that.globalData.urlDomain + ‘/a/192/appraise/upLoadImage’,

        filePath: filePaths[i],

        name: ‘fileData’,

        formData: {

          ‘imageName’: filePaths[i],

          ‘fparentid’: encodeURIComponent(fparentid),

          ‘fnumber’:fnumberList[i]

        },

        success: function(resp){

          console.log(resp.statusCode)

          successUp++;

        },

        fail: function(res){

          failUp++;

          if(i==length){

            wx.switchTab({

              url: ‘/pages/appraise/appraising/appraising’

            })

          }

        },

        complete: function(){

          i++;

          if (i == length) {

            console.log(‘总共’ + successUp + ‘张上传成功,’ + failUp + ‘张上传失败!’);

            wx.showToast({

                title: ‘提交完成’,

                duration: 3000

              })

            wx.switchTab({

              url: ‘/pages/appraise/appraising/appraising’

            })

          }

          else {  //递归调用uploadDIY函数

            this.uploadDIY(filePaths, successUp, failUp, i, length, fparentid,fnumberList);

          }

        },

      });

    }

    else {

      console.log(‘没有要上传的图片’)

       wx.showToast({

                title: ‘提交完成’,

                duration: 5000

              })

      wx.switchTab({

        url: ‘/pages/appraise/appraising/appraising’

      })

    }

  },

是使用递归上传多张图片的

回到顶部