Skip to content

How to fix the `Upload preset not found` error in Cloudinary

New Course Coming Soon:

Get Really Good at Git

I was doing a test project that used Cloudinary as the image storage.

I ran into this issue when I tried uploading the image. I received a 400 Bad Request with this JSON message:

{"error":{"message":"Upload preset not found"}}

Turned out I didn’t set up an Upload Preset.

You need to go in the Settings in your Cloudinary Dashboard, in the Upload tab you click “Add upload preset”, and you add one.

Then you use that preset name in your Cloudinary upload code.

For example I had a canvas object from an HTML canvas I wrote to, and this was the code to upload it to Cloudinary as an image:

const base64Image = canvas.toDataURL()
const formData = new FormData()
formData.append('file', base64Image)
formData.append('upload_preset', '***THE_PRESET_NAME***')

fetch(`https://api.cloudinary.com/v1_1/***YOUR_CLOUD_NAME***/image/upload`, {
  method: 'POST',
  body: formData,
})

Tip: while testing you might choose to add an unsigned upload preset, as it simplifies the code.

Are you intimidated by Git? Can’t figure out merge vs rebase? Are you afraid of screwing up something any time you have to do something in Git? Do you rely on ChatGPT or random people’s answer on StackOverflow to fix your problems? Your coworkers are tired of explaining Git to you all the time? Git is something we all need to use, but few of us really master it. I created this course to improve your Git (and GitHub) knowledge at a radical level. A course that helps you feel less frustrated with Git. Launching May 21, 2024. Join the waiting list!

Here is how can I help you: