【问题标题】:Delete image from Clodinary using axios delete使用 axios delete 从 Cloudinary 中删除图像
【发布时间】:2020-03-02 21:14:14
【问题描述】:

我正在使用 axios 发布请求在 cloudinary 上上传图像,我也想使用 axios delete 删除图像,但我找不到任何 api url 或任何代码可以帮助我使用 axios delete 向 cloudnary 发送删除请求。

使用此代码将图片上传到 Cloudinary
let imageFile = this.props.img
        var formData = new FormData()
        formData.append('file', imageFile)
        formData.append('upload_preset', Routes.CLOUDINARY_PRESET)
        await axios.post(Routes.CLOUDINARY_API, formData)
          .then(function (res) {
            imageURL = res.data.secure_url
          })
          .catch(function (err) {
            console.log("err", err)
          })

【问题讨论】:

    标签: javascript node.js reactjs axios cloudinary


    【解决方案1】:

    虽然您可以通过客户端上传到 Cloudinary,但出于安全原因,您不能删除资源。如果您想删除资源,则还需要将signature 作为参数传递。

    建议generate signature server-side,因为这需要您公开帐户的 API 机密。

    【讨论】:

      猜你喜欢
      • 2020-05-05
      • 2020-12-18
      • 2020-11-05
      • 2015-08-11
      • 2019-01-30
      • 2019-05-25
      • 2017-10-25
      • 2013-11-01
      • 2015-09-30
      相关资源
      最近更新 更多