急:上传多媒体文件出错

发布于 7 年前作者 baiyong1879 次浏览最后编辑 7 年前来自 ask

使用模拟器上传视频文件提示errMsg: “uploadFile:fail file not found”

使用苹果手机上传视频文件提示errMsg:“uploadFile:fail file path invalid”

程序代码

   that.upload({ path: 视频选择得到的路径});

upload: function (path) {

    wx.uploadFile({

      url: ‘https://…/upload’, //上传地址

      filePath: path+‘’,   //视频路径

      name: ‘video’,

      header: { ‘content-type’: ‘multipart/form-data’ },

      formData:null,

      success: function (res) {

        // success

        console.log(“成功”)

        console.log(res.data)

      },

      fail: function (res) {

        // fail

        console.log(“失败”, res)

      },

      complete: function () {

        // complete

        console.log(“完成”)

      }

    })

  }

3 回复
yangsong
yangsong1 楼6 年前

直接 filePath: path+‘’,   //视频路径 这样写的

fangpeng
fangpeng2 楼6 年前

path 其实就是 console里输入的video ,实际已经取到了视频文件的路径

mingshen
mingshen3 楼5 年前

filePath给的对吗?path传进来不是object吗?