0
votes

I am uploading an Image on cloudinary using axios post request and I also want to delete images using axios delete but I couldn't find any api url or any code that can help me to send delete request to cloudnary using axios delete.

Using This code to upload image on 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)
          })
1

1 Answers

1
votes

While you can upload to Cloudinary through the client-side, you cannot delete resources for security reasons. If you would like to delete the resource then signature also needs to be passed as a param.

It is recommended to generate signature server-side as that requires you to expose your account's API secret.