Yes. Cloudinary was upgraded in March 2013 to support folders.
From here on, your images' public ID can contain one or more folders, e.g.
http://res.cloudinary.com/demo/image/upload/v1364158979/multiple/folders/sample.jpg
For example, here's a Ruby code sample that uploads an image with the above url (note - this requires the Gem v1.0.50+):
Cloudinary::Uploader.upload("sample_image.jpg", :public_id => "multiple/folders/sample")
The Ruby code that builds this URL:
cloudinary_url("multiple/folders/sample", :version => "1364158979", :format => :jpg)
Alternatively, here's the Rails cl_image_tag that will display this image:
cl_image_tag("multiple/folders/sample", :version => "1364158979", :format => :jpg)
Notes
- By default, when uploading via the API, folders are not automatically created in your Media Library. In order to automatically create the folders based on the API requests, please go to your account upload settings and set the 'Auto-create folders' option to enabled.
- If you build the URLs by yourself, you'll need to add a version component for folders to work. If you aren't planning on overriding your images, you can simply use "v1" as the version number. Our client integration libraries will automatically add the correct version for you.
- While the samples above are based on Ruby/Rails, all of our latest client integration libraries support the folders functionality.
UPDATE #1
You can now add the new folder
parameter to the upload call to specify the folder while uploading. This includes uploading multiple images.
For more information:
http://support.cloudinary.com/entries/25760887-Can-I-upload-files-to-a-folder-while-keeping-their-original-file-names-
UPDATE #2
You can now create folders from the Media library as well:
Comments
16 comments
I'm actually looking to do a similar thing. Is there an ETA on folders? What separators are supporting in the public ID because / is not and that would of course solve this issue..
Hi Eric,
There is no ETA yet. We will update you when we have more details.
You can use any standard separator (not slash...) to match your naming convention.
You can use a colon ':' as a separator. This character is not common in entity names and file names. For example: 'gallery:actors:john_doe'.
Thanks,
Nadav
UPDATE: Cloudinary supports folders as described in the updated article above.
I need to upload multiple files in a folder structure while preserving their names. How do you do that? it seems you can only create a folder through public_id, i've been using jquery plugin to do that, with the input file tag, if i use 'public_id' in the data-form-data field, it uploads only one file
Hi Sendy,
Currently it's needed to upload the files one-by-one. We're working on a solution for bulk uploads. This will allow specifying a folder name and allow "use filename" in parallel.
Hi,
Would it be possible to request a REST service in the Admin API that returns the complete folder structure for an account? I need something along those lines as I am writing a Cloudinary plugin module for a large CMS, and the end user must be able to sort through their image library by conventional means (i.e. folders).
Hi Erik,
Getting folder structure using our API is currently not supported. You can use the Admin API to search images by prefix that include the folder name. In addition, you can assign tags and then search images by tags.
Does your web based Media Library interface support folders and if so, how?
The public ID can contain folders, you can specify the desired public ID (e.g., "multiple/folders/sample") while uploading.
Public IDs can be specified in the Media library by clicking the "More upload options".
Is it possible to add folders when using Cloudinary::CarrierWave?
After chatting with cloudinary support, I can report that with the Cloudinary::CarrierWave plugin, you just do something like:
classPictureUploader** < *CarrierWave::Uploader::Base* **
include **Cloudinary*::CarrierWave*
...
**def ***public_id*
**return**** "*folder1/folder2/" + model.short_name*
**end**** **
end
Can you create a folder though the php API or a direct post? I need to allow my users to create folders regardless of any images in it.
Can I add a custom function in php to do a return $this->call_api("post", array("folders"), array(), $options);
While empty folders can be created via the Admin Console, currently the API doesn't support creating empty folders.
Folders are automatically created when uploading a new file. Either by including the folder as part of the
public_id
:\Cloudinary\Uploader::upload('my_image.jpg', array("public_id" => "my_folder/my_name"));
Or, by using the
folder
parameter:\Cloudinary\Uploader::upload('my_image.jpg', array("public_id" => "my_name", "folder" => "my_folder"));
Hi,
I had used following code
\Cloudinary\Uploader::upload(' Testimage.jpg', array("public_id" => "Abcd/Testimage"));
as well as
folder
parameter:\Cloudinary\Uploader::upload(' Testimage.jpg', array("public_id" => "Testimage", "folder" => "Abcd"));
but i get image name as : ** Abcd/Testimage.jpg**
and Url : http://res.cloudinary.com/armv/image/upload/v1421142637/Abcd/Testimage.jpg
there is no folder name "Abcd" in Media Library
Hi, i'm using wordpress, and I want to change my uploads folder to a folder in cloudinary. I've tried with a plugin without success. Could you tell me if it is possible? and how? thanks in advance, juan
Hi Abhishek,
You can enable folder's auto-creation inside the console (settings > upload > Auto-create folders)
Please note that this change will only affect new uploads.
Hi Juan,
There are several ways to upload images to cloudinary's account using Wordpress.
You can either directly upload it by using the Cloudinary Upload/Insert link inside [Posts > Edit post]
Or by first, uploading the images to the Wordpress media library and then migrate it to your cloudinary's account as described here:
https://wordpress.org/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/faq/
If this doesn't solve your use-case please don't hesitate opening a support ticket:
http://support.cloudinary.com/tickets/new
Please sign in to leave a comment.