Can I upload files to a folder while keeping their original file names?

Follow

Comments

12 comments

  • Avatar
    Frank Bruce

    If I upload to an folder, it includes the folder in the image URL, but if I check on the Media Library the image is there with the folder in its url, but the new folder has not been created. If I then create the new folder using the create folder button, it creates the folder and any images can then be viewed under that folder.

    It would be nice for the folder to automatically be generated, or is there a way via the API?

  • Avatar
    Itay Taragano

    Hi Frank,

    You can go to your  Settings page and enable Auto-create folders.

    This will automatically synchronize the resources and folders created by the API with the Media library.

  • Avatar
    Robert Jackson

    Is this "folder" parameter available for the PHP API?  I do not see it listed in the API Documentation http://cloudinary.com/documentation/php_image_upload

    I guess I can just try it.  Also how many images can a folder hold before a new folder should be created?  I'll be processing the images and compressing them by 75% first so the files should be fairly small.

  • Avatar
    Itay Taragano

    Hi Robert,

    While it isn't documented yet, indeed the folder parameter is available for the PHP API as well. Here's an example:

    \Cloudinary\Uploader::upload('my_image.jpg', array("folder" => "my_folder"));

    You can store as many images as you need, there is no limit per folder.

  • Avatar
    Robert Jackson

    Awesome thanks. I am about to try this. My local file structure will be different from my cloudinary file structure.

  • Avatar
    Glenn Goodrich

    So, could I use this to separate staging and production environments? Or do you have another suggestion for that?

  • Avatar
    Itay Taragano

    You can indeed use folders to separate the resources from staging and production environments. 

    However, we usually recommend to have different accounts for staging and production, and copy required images from one account to the other. You can use Cloudinary's Auto-migration feature which you can have your staging account syncing with your production automatically only for your used images. Note that all images of production account will be stored within a folder in your staging account.

    For more information:

    http://cloudinary.com/blog/how_to_automatically_migrate_all_your_images_to_the_cloud

    From our Advanced Extra plan, we support having our multi-accounts feature which allows you to manage up to five different accounts via a single login, where all accounts share the master account's usage quotas.

  • Avatar
    ankit parsana

    Hi I am uploading images from the media library and I dont want the appended unique characters for the original file name. Is there any setting for that from the interface.

  • Avatar
    Itay Taragano

    When you upload images via the Media library to the root directory, Cloudinary indeed automatically adds a short random string to the public ID to ensure uniqueness. For more information:

    http://support.cloudinary.com/entries/26977753-Why-does-the-public-ID-include-additional-characters-appended-to-the-original-file-name-

    However, when you upload into a folder, the extra string is not added to the public ID.

    You can also tell Cloudinary to not add the extra string when uploading the API. For more information:

    http://support.cloudinary.com/entries/25830181-How-to-upload-images-while-keeping-their-original-filenames-

  • Avatar
    Itay Taragano

    UPDATE
    You can now set "Use file name in Media Library" in your account's Upload settings page to tell Cloudinary to not add random characters in the root directory either.

  • Avatar
    MichaelPrenz

    Hello Itay,

    I use the Auto Upload Feature to get an image.
    I want the image name as Public ID and enabled it in the settings.

    Now I want to use THIS image as watermark and use it with the overlay parameter "l".
    But because I have to choose a folder for Auto upload,
    the Public ID always containts the foldername and "/" in it`s name, which I can not use with the overlay parameter.

    How can I do it this way ?
    I do not want to put hands on the prozess, (the images changes, no solid watermark ! - no renaming e.g. manuell)
    Is there a way to choose the root folder for auto upload ?
    Or is there an "Auto" Rename Function to get rid of the (/) in the name ?

    Thank you so much for your help !

    Regards

  • Avatar
    Nadav Ofir

    Hi Michael,
    Here's an article that explains how to solve the folders hierarchy matter:
    https://support.cloudinary.com/hc/en-us/articles/202521352-How-to-use-an-image-from-a-sub-folder-as-an-overlay-
    Moreover, you can map your root directory by putting a slash ("/") inside the "Folder" field.

Please sign in to leave a comment.