Skip to main content

Creating a Vue.js Application for Uploading Assets to Cloudinary

Comments

3 comments

  • Issei Mendez

    How i can delete a image from vuejs?

    0
  • Ismael

    Good morning. When executing the code I get an error in the console: "

    Access to XMLHttpRequest at 'https://api.cloudinary.com/v1_1/CLOUD_NAME/upload' from origin 'http://localhost:8080' has been blocked by CORS policy: Request header field operador is not allowed by Access-Control-Allow-Headers in preflight response."

    "
    How can I fix it?

    Thank you very much!

    0
  • Rebecca Peltz

    In order to update or delete an asset from Vue.js, you need to use a server and call the Upload or Admin API. I recommend the Upload API SDK destroy method: https://cloudinary.com/documentation/image_upload_api_reference#destroy_method. If you use Nuxt, you can deploy your own server API with your vue.js code and call it from Vue.js using an http client like fetch or axios. The reason you can do a fully front end destroy (or update) is because it requires credentials (key and secret) which you don't want to expose in the front end. The upload API allows you to use the unsigned preset and that's what makes uploading (create) possible.

    0

Please sign in to leave a comment.