Upload presets

Upload presets enable you to centrally define a set of asset upload options instead of specifying them in each upload call. You can define multiple upload presets and apply different presets in different upload scenarios.

You can set your presets as signed or unsigned. Unsigned presets can be used with unsigned upload calls, such as uploading directly from the browser, in the upload widget or for Auto Upload settings.

Upload presets can be defined using the UI in the Upload settings of the Management Console or with the upload_presets method of the Admin API.

Note
When defining an upload preset that may be used for both image and video uploads, you can include both image- and video-specific upload options (e.g., for moderation or tagging add-ons) and only the relevant options will be used when a file is uploaded with that preset. Any upload options in your preset that apply to a different format are silently ignored. However, if you also supply incoming or eager transformations as part of such an upload, make sure all transformation parameters that you include in the call are relevant for both images and videos.

Use cases

Some use-cases for using upload presets include:

  • Generating eager transformations for uploaded files. This is especially valuable for video transformations that may take longer to generate and helps to ensure your uploaded files will be ready for delivery.
  • Applying incoming transformations while uploading a file, for example to limit format types or file size before storing uploaded files in your Cloudinary account.
  • Applying add-on capabilities, such as auto-tagging to your uploads.
  • Simplifying control and management of uploading files.
  • Updating the behavior of user-generated content uploads without modifying the website or mobile app code.
  • As upload preferences for uploads via the Upload widget.

Default upload presets

From the Upload settings, you can also individually select signed upload presets that will act as the Default upload presets for images, videos, and raw files respectively. You can select one set of presets for API calls and another set for uploads via the Media Library. The settings in these default presets are applied to all uploads of the relevant asset type whenever no other preset is specified directly in an upload call or when uploading assets to the Media Library.

Default upload preset settings

Using upload presets in upload calls

Each upload preset has a unique name. To apply an upload preset when uploading an asset, specify the preset name as the value of the upload_preset parameter. For example, uploading the image sample.jpg and specifying an upload preset named my_image_preset:

Ruby:
Copy to clipboard
Cloudinary::Uploader.upload("sample.jpg", 
  :upload_preset => "my_image_preset")
PHP:
Copy to clipboard
\Cloudinary\Uploader::upload("sample.jpg", 
  array("upload_preset" => "my_image_preset"));
Python:
Copy to clipboard
cloudinary.uploader.upload("sample.jpg", 
  upload_preset = 'my_image_preset')
Node.js:
Copy to clipboard
cloudinary.v2.uploader.upload("sample.jpg", 
  { upload_preset: "my_image_preset" }, 
  function(error, result) {console.log(result, error) });
Java:
Copy to clipboard
cloudinary.uploader().upload(new File("sample.jpg"),
  ObjectUtils.asMap("upload_preset", "my_image_preset"));
.Net:
Copy to clipboard
var uploadParams = new ImageUploadParams(){
  File = new FileDescription(@"sample.jpg"),
  UploadPreset = "my_image_preset"};
var uploadResult = cloudinary.Upload(uploadParams);
iOS:
Copy to clipboard
let params = CLDUploadRequestParams()
  .setUploadPreset("my_image_preset")
var mySig = MyFunction(params)  // your own function that returns a signature generated on your backend
params.setSignature(CLDSignature(signature: mySig.signature, timestamp: mySig.timestamp))
let request = cloudinary.createUploader().signedUpload(
  url: "sample.jpg", params: params)