wx.cloud.upLoadFile多次上传,fileId不覆盖?
发布于 4 年前 作者 weiguiying 10609 次浏览 来自 官方Issues

老师您好,我想问一下用wx.cloud.upLoadFile多次上传图片用同一个地址的话,不应该是覆盖之前那一张吗?可我发现云端数据库确实是覆盖了,但是回调的fileID还是之前那张图的。这是咋回事?

1 回复

用fileID获取https地址吧

wx.cloud.getTempFileURL({
  fileList: [{
    fileID: res.fileID,
    maxAge60 * 60// one hour
  }]
}).then(res => {
  // get temp file URL
  console.log(res.fileList)
  t.setData({
    src:res.fileList[0].tempFileURL+'?'+(new Date().valurOf()) // 加时间戳,防止缓存
  })
}).catch(error => {
  // handle error
})

若认为该回答有用,给回答者点个[ 有用 ],让答案帮助更多的人

回到顶部