使用wx.uploadFile(OBJECT)上传JAVA后端捕获文件的问题
发布于 5 年前 作者 mingliang 12892 次浏览 来自 问答

  bindButtonTap1: function () {

    var that = this

    wx.chooseImage({

      count: 1, // 默认9

      sizeType: [‘compressed’],

      sourceType: [‘album’, ‘camera’],

      success: function (res) {

        var tempFilePaths = res.tempFilePaths

        that.setData({

          paths: tempFilePaths[0]

        })

        wx.uploadFile({

          url: ‘https://www.XXXXXXX/test-wechat’,

          filePath: tempFilePaths[0],

          name: ‘file’,

          formData: {

            ‘user’: ‘test’

          },

          success: function (res) {

            var data = res.data

            //do something

          }

        })

      }

    })

  }

小程序中采集到了图片并且本地可以预览出来,但是服务端用Java捕获流的时候是空的,请问用Java在后端接收上传的图片文件应该怎么做?

1 回复

同求,有人解决了吗

回到顶部