image-uploadingcloudinary

How to save an image to a specific folder with Cloudinary?


I want to save an image file in a specific folder on Cloudinary. The folder name is "userimg".

Here is my code to save without a folder.

My cloudinary and folder directory.


Solution

  • Cloudinary Upload API supports a folder parameter. See - https://cloudinary.com/documentation/image_upload_api_reference#upload

    Please try adding:

    formData.append('folder', 'userimg');
    

    You can also include the folder in the public ID, e.g., 'myfolder/myimageid'.

    Also, see:

    https://support.cloudinary.com/hc/en-us/articles/202520902-Can-I-create-folders-in-my-Cloudinary-account-