微信小程序做图片上传阿里云服务器 需要配置一些什么 有没有大佬可以指点一下

  uploading1: function () {
    var that = this
    wx.chooseImage({
      count: 3, // 默认9
      sizeType: ['original','compressed'], // 可以指定是原图还是压缩图,默认二者都有
      sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
      success: function (res) {
        // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
        let tempFilePaths = res.tempFilePaths
        console.log(tempFilePaths,"打印第一次")
        let myDate = new Date()
        let ossPath = 'seekings/' + myDate.getFullYear()
        console.log(ossPath,"osspath")
        for (var i = 0; i < tempFilePaths.length; i++) {
          // 获取文件后缀
          var pathArr = tempFilePaths[i].split('.')
          console.log(pathArr,"pathArr")
          //  随机生成文件名称
          var fileRandName = Date.now() + "" + parseInt(Math.random() * 1000)
          console.log(fileRandName,'fileRandName')
          var fileName = fileRandName + '.' + pathArr[3]
          console.log(fileName,"fileName")
          // 要提交的key
          var fileKey = ossPath + '/' + fileName
          console.log(fileKey,"fileKey")
          wx.uploadFile({
            // url: 'https://scrkscrk.com/cqz',
            url:"http://oss-cn-beijing.aliyuncs.com/cqz",
            filePath: tempFilePaths[i],
            name: 'file',
            formData: {
              name: tempFilePaths[i],
              key: fileKey,
              policy: 'policyBase64',
              OSSAccessKeyId: 'LT89w90ecV00j7',
              signature: 'nPdwauIvUMkrML0tbC5mtm5HbYW',
              success_action_status: "200"
            },
            success: function (res) {
              var data = res.data
              console.log(data,"12")
              console.log(res)
            }
          })
        }
        that.setData({
          upliadImages: res.tempFilePaths
        })
      }
    })
  },

 

请问各位大佬这是什么原因 以及解决办法  谢谢!

 

你上传地址不对把, 上传地址类似 https://*******.oss-cn-hangzhou.aliyuncs.com ,*******值 是buckt名,还有用for, 在里面最好直接用tempFilePaths[i]取值,在for里面在赋值一个变量  var currentFile = tempFilePaths[i], formData: {name: tempFilePaths[i], 这个使用文件名称就行 别用文件对象

别直接用tempFilePaths[i]取值

https://blog.csdn.net/xw245184020/article/details/94215806?spm=1001.2014.3001.5502