首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >微信小程序wx.uploadFile如何上传文件到对象存储cos上?

微信小程序wx.uploadFile如何上传文件到对象存储cos上?

提问于 2018-06-02 12:12:19
回答 4关注 0查看 3.8K

感觉无论怎么调用fileContent都没有传过去

wx.uploadFile({
          url: 'https://sh.file.myqcloud.com/files/v2/1252097407/txztest/testxcx.jpg?sign=' + sign,      // 此处换上你的接口地址
          filePath: tempFilePaths[0], // 使用chooseImage获取的文件
          name: 'testxcx.jpg',
          header: {
            'Content-Type': 'multipart/form-data',
            'accept': 'application/json'
          },
          formData: {
            'op': 'update',
            'insertOnly': 0,
            'fileContent': tempFilePaths[0]
          },
          success: function (res) {
            console.error(JSON.stringify(res))
          },
          fail: function (res) {
            console.error(JSON.stringify(res))
          }
        })
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档