上传图片 uploadFile:fail Error: form-data:
发布于 5 年前 作者 xia30 6106 次浏览 来自 问答

错误如下  uploadFile:fail Error: form-data: ENOENT: no such

源码如下,请各位大神指导一下,为啥上传不成功

var that = this

    wx.chooseImage({

      count: 9,

      success: function(res) {

        var tempFilePath = res.tempFilePaths[0]

        wx.saveFile({

          tempFilePath: tempFilePath,

          success: function(res) {

            console.log(tempFilePath);

            wx.uploadFile({

              url: ‘https://www.xxx.com/Post1’, 

              filePath: tempFilePath,

              name: ‘file’,

              success: function(res){

                console.log(‘success’);

                //console.log(res.data);

                //var data = res.data

                //do something

              },

              fail:function(res){

                console.log(res);

              }

            })

          }

        })

      }

    })

回到顶部