Last updated: Aug-06-2025
The Upload widget API reference details all the parameter options that you can use when configuring the Upload widget.
The options in this reference relate to the latest version of the Cloudinary Upload widget.
Initialization methodsThe Initialization JavaScript methods are publicly available after including Cloudinary's Upload widget JavaScript file.
The all.js
file instantiates the cloudinary
class with access to the following methods:
For the list of methods that can be used with the returned widget object from one of these initialization methods, see the
instance methods.
setCloudNameGlobally sets the cloud name for all widget method calls.
Syntaxcloudinary.setCloudName(name)
Creates a widget object and frame in memory, but does not display it until the open() method of the returned widget object is called.
Improve the perceived performance of your site by creating the widget while your site is loading and then calling the
open()
method from a click event.
Syntaxcloudinary.createUploadWidget(options, resultCallback)
function(error, result)
where error
is either null
if successful or an error message if there was a failure, while result
is a JSON object detailing the triggered event. Example openUploadWidget
Creates a widget object and frame in memory, and also opens the widget.
Syntaxcloudinary.openUploadWidget(options, resultCallback)
function(error, result)
where error
is either null
if successful or an error message if there was a failure, while result
is a JSON object detailing the triggered event. Example applyUploadWidget
Creates a widget object and frame in memory, and also modifies a given element to a blue button (customizable look & feel) that, when clicked, opens a pre-created Upload widget. In addition, the form
and thumbnails
options are implicitly set by default to the containing form of the given element.
cloudinary.applyUploadWidget(element, options, resultCallback)
function(error, result)
where error
is either null
if successful or an error message if there was a failure, while result
is a JSON object detailing the triggered event. Example cloudinary_upload_widget
For use with jQuery - supported only for backward compatibility with Upload widget 1.x
Same as applyUploadWidget
. Uses a jQuery selector to apply the widget on matching elements.
Besides for the required parameters, only include other parameters in order to override their default values.
The following tables list all available parameters (options) for creating and initializing an Upload widget with one of the Initialization methods method:
The standard
camelCaseoption names are shown here.
For backward compatibility with Upload widget 1.x,
snake_caseis also supported.
Required parametersThe following parameters are required when initializing the Upload widget:
Parameter Type Description cloudName String Your Cloudinary product environment cloud name. Can be set either globally usingsetCloudName
or explicitly for each widget creation call.
demo
uploadPreset String
uploadSignature
is used) The name of an upload preset defined for your product environment. If using the Upload widget for unsigned uploads, make sure you specify an unsigned upload preset, and conversely, if you choose to provide an upload preset for a widget performing signed uploads, make sure you provide a signed upload preset. You can define upload presets either on the Upload page of the Console Settings or by using the Admin API.
preset1
Widget parameters Parameter Type Description sources Array of Strings List of sources that should be added as tabs (web) or source options (mobile/responsive) in the widget. Possible values: local
, url
, camera
, dropbox
, image_search
, shutterstock
, gettyimages
, istock
, unsplash
, google_drive
camera
is not relevant for mobile devices (the local
option also allows capturing from the camera on mobile devices) and is currently supported in all modern browsers (not supported in Internet Explorer or Desktop Safari).camera
and dropbox
source options will appear only if the Upload widget is embedded in an HTTPS page.true
. encryption Map of key-iv pairs The encryption key and initialization vector to use for encrypting uploaded files.
{ key: "ff234fe526725753fa45b53325", iv: "cd8a46d72e26a365dca78ef" }
defaultSource String The source that's selected when the widget is opened.
local
multiple Boolean Whether selecting and uploading multiple assets is allowed. Completion callback is called only when all assets complete uploading. If set to true, multiple hidden fields of asset identifiers are created. If set to false, only a single asset is allowed in any source. See note below.
true
maxFiles Integer The maximum number of files allowed in multiple upload mode. If a user selects or drags more than the allowed amount, no files will be uploaded. See note below.
10
Cloudinary recommends setting a limit for
maxFiles
. Although the widget does not limit the number of uploads from the front end side, there is a limit of 20 simultaneous calls on the backend side.
Cropping parameters Parameter Type Description cropping Boolean Set totrue
if you want to allow your users to interactively crop their images before uploading them to Cloudinary. Interactive cropping allows users to mark the interesting part of images, and the selected dimensions are sent as the customCoordinates
or faceCoordinates
upload parameter, depending on the value used for croppingCoordinatesMode
.
gravity
to custom
or faces
(as appropriate) when generating delivery URLs will deliver the image with the cropping that the user defined in the widget. Incoming cropping can be applied before saving the image by including the crop mode set to custom
gravity in your upload preset.
multiple
widget parameter to false
in order to enable interactive cropping.
false
showSkipCropButton Boolean Whether to display the 'skip' button on the interactive cropping step, making the step mandatory if set to false.
cropping
feature is enabled.
true
croppingAspectRatio Decimal If specified, enforce the given aspect ratio on the selected region when performing interactive cropping. The aspect ratio is defined as width/height. For example, 0.5 for a portrait oriented rectangle or 1 for square.
cropping
feature is enabled.
null
0.5
croppingDefaultSelectionRatio Decimal Initialize the size of the cropping selection box to a different value from the default. The value is calculated as a proportion of the image's size.
cropping
feature is enabled.
1.0
. Range: 0.1
to 1.0
.
0.75
croppingShowDimensions Boolean Whether to display the cropping dimensions in the top left corner of the cropping region.
cropping
feature is enabled.
false
. croppingCoordinatesMode String: custom
or face
Determines how to apply the selected region coordinates:
custom
- the selected region is set as the customCoordinates
upload parameter (default).
face
- the selected region is set as the faceCoordinates
upload parameter.
cropping
feature is enabled.
cropping
feature is enabled.
true
Sources parameters
See the Third-party upload sources section for more details on working with the various sources.
Parameter Type DescriptionDropbox:
dropboxAppKey String Your DropBox App key. Required if adding the dropbox
source. Image search:
googleApiKey String Your API key needed to access Google APIs. Required if adding the image_search
source. searchBySites Array of strings The URLs of sites to allow for Image Search. If more than one site is given, the Search by Site drop-down is added. To allow searching the entire web, use the value "all".
all
searchByRights Boolean Set to true
to add a drop-down box for your users to select a licensing filter when using the search.
false
Google Drive:
googleDriveClientId String The Client ID of your own Google Drive application for accessing your users Google Drive accounts. Defaults to using the Cloudinary Google Drive app to access their accounts if not provided. Upload parameters Parameter Type Description publicId String Custom public ID to assign to a single uploaded asset. If not specified, either a randomly generated string or the original file name is used as the public ID according to the unsigned upload preset. To ensure secure usage, overwriting previously uploaded assets sharing the same public ID is not supported (unless you also include "overwrite = true" in the upload preset).
null
profile_11002
asset_folder String The folder where the uploaded assets are placed within the Cloudinary repository. This value doesn't impact the assetâs public ID path.
null
(uploads to root folder, even if the public ID value includes slashes)
user_photos
Not relevant for product environments using the legacy fixed folder mode.
folder StringOnly relevant for product environments using the legacy fixed folder mode.
The full path of the folder where the uploaded assets are placed and also a path value that's prepended to all public_id
values with a forward slash.
Default: null
(uploads to root folder)
Example: user_photos
Note: If Dynamic folders mode is enabled on your product environment, this parameter is deprecated, and it's recommended to use the asset_folder
parameter to control where the asset will be placed.
false
publicIdPrefix String The string to add as a prefix for all public IDs. tags Array of Strings One or more tags to assign to the uploaded assets.
null
.
['users', 'content']
resourceType String Limits uploaded files to the specified type. By default, all resource types are allowed.
auto
, image
, video
, raw
.
auto
. context Map of key-value pairs Additional contextual metadata to attach to the uploaded resources.
{ alt: "my_alt", caption: "my_caption"}
detection String Invokes the relevant add-on.
Set to:
coco_v2
) to detect content using the Cloudinary AI Content Analysis add-on.adv_face
to detect facial attributes using the Advanced Facial Attribute Detection add-on.aws_rek_face
to detect celebrities and facial attributes using the Amazon Rekognition Celebrity Detection add-on.detection
parameter on upload. For more details see On Success update script. uploadSignature string or function Either a string representing the precalculated signature of all upload parameters used, or a function to generate the signature string dynamically. The function accepts 2 parameters, the first is a resultCallback (function) and the second is an object with the relevant upload parameters that are needed for generating the signature.
c347053314777423cd4f
uploadSignature
is also provided.
1315060076
Client-side parameters Parameter Type Description clientAllowedFormats Array of Strings Allows client-side validation of the uploaded files based on their file extensions. You can specify one or more file extensions, and/or limit the allowed files to "video" or "image". Only applies when uploading files from a local device.
null
.
["webp", "gif", "video"]
maxFileSize Integer. Number of bytes. If specified, perform client-side validation to prevent uploading files larger than the given bytes size.
5500000
(5.5 MB)
local
files only
1500000
(1.5 MB)
maxFileSize
(if set) for images
local
files only
15000000
(15 MB)
maxFileSize
(if set) for videos
local
files only
2000000
(2 MB)
maxFileSize
(if set) for raw files
local
files only
validateMaxWidthHeight
to prevent uploading of images that exceed this value.
null
(no resizing)
2000
maxImageHeight Integer. Number of pixels. If specified, client-side scale-down resizing takes place before uploading if the height of the selected file is larger than the specified value.
validateMaxWidthHeight
to prevent uploading of images that exceed this value.
null
(no resizing)
2000
validateMaxWidthHeight Boolean If specified, client-side validation takes place before uploading. If the width and/or height of the image is larger than maxImageWidth
and/or maxImageHeight
respectively, the upload is cancelled and no client-side scale-down resizing takes place.
false
(no validation) minImageWidth Integer. Number of pixels. If specified, client-side validation takes place before uploading. If the width of the selected file is smaller than the specified value, the upload is cancelled.
null
(no validation)
200
minImageHeight Integer. Number of pixels. If specified, client-side validation takes place before uploading. If the height of the selected file is smaller than the specified value, the upload is cancelled.
null
(no validation)
200
croppingValidateDimensions Boolean Relevant only if the cropping
feature is enabled AND one or more of the following parameters are also set: maxImageWidth
, maxImageHeight
, minImageWidth
or minImageHeight
.
cropping
region marked by the user.
false
. maxChunkSize Integer. Number of bytes. Configure the maximum chunk size for uploading large files. The value must be at least 5 MB (5000000
).
20000000
Containing page parameters Parameter Type Description form CSS selector The selector (CSS path) of the form, to which you would like to append hidden fields with the identifiers of the uploaded assets.
applyUploadWidget
or $.fn.cloudinary_upload_widget
.
null
#my_form
fieldName Form field name The name of the hidden field added to your form when uploading is completed. Multiple hidden fields with the same name are created for multiple uploaded assets. The name can include []
for supporting web frameworks such as Ruby on Rails.
image
photo[]
thumbnails CSS selector The selector (CSS path) of an HTML element that acts as the container for appending upload thumbnails.
null
.content .uploaded
thumbnailTransformation String or Array of maps The Cloudinary transformation (manipulation) to apply on uploaded assets for embedding thumbnails in your site. Any resizing, cropping, effects, and other Cloudinary image transformation options can be applied by specifying a transformation string or an array of mapped transformations.
[{ width: 90, height: 60, crop: 'limit' }]
[{ width: 100, height: 100, crop: 'fit' }]
[ {width: 200, height: 200, crop: 'fill'}, {effect: 'sepia'} ]
"w_200,h_200,c_fill"
Customization parameters Parameter Type Description buttonClass String Enables you to override the default CSS class name of the upload button added to your site. The default CSS style is applied to the cloudinary-button
class, which you can override using CSS directives. Alternatively, you can specify any class name that matches your website design.
cloudinary-button
buttonCaption String Enables you to override the default caption of the upload button added to your site.
Upload image
theme String The name of a predefined widget theme. Widget behavior is the same for all themes.
default
, white
, minimal
, purple
.
default
styles Object Advanced customization of the widget's look & feel. Enables you to override the widget's default colors, fonts, icons and other elements by providing a custom style definition. See the Look and feel customization sample as a reference implementation. Default: the widget's default settings are used for all elements that are not specifically overridden text Object "key":"value" pairs of text to override the widget's default text labels. See the Localization sample as a reference implementation. Advanced parameters Parameter Type Description showPoweredBy Boolean Whether the Powered By Cloudinary icon is displayed.
true
.
false
getTags Function A function that is called for adding tagging suggestions whenever the text changes in the Add a Tag
Advanced text field. getUploadPresets Function A function that is called for populating an upload preset selection field added to the Advanced options. preBatch Function A function that performs pre-batch validation before the upload starts. prepareUploadParams Function A function for preparing upload parameters before the upload starts. The prepareUploadParams callback only supports preparing the following parameters: apiKey
, auditContext
, context
, folder
, invalidate
, metadata
, overwrite
, publicId
, qualityAnalysis
, resourceType
, signature
, tags
, uniqueFilename
, uploadPreset
uploadSignatureTimestamp
, useFilename
. language String Determines which of the text
parameter languages to use for the widget.
en
showAdvancedOptions Boolean Whether to display the Advanced options, which enables users to set the Public ID, Add a Tag, and select an Upload Preset (only if getUploadPresets
is defined).
false
showCompletedButton Boolean Whether the Completed button will be displayed after the upload completes. When a user clicks the button, the widget fires the show-completed
event.
false
showUploadMoreButton Boolean Whether the Upload More button will be displayed after the upload completes.
true
singleUploadAutoClose Boolean Whether the Upload widget automatically closes after the upload completes.
true
queueViewPosition String The display position of the minimized upload queue expressed as an offset value from either the right or left edge, followed by a colon and then the offset value in CSS units from that edge.
right:35px
showInsecurePreview Boolean Whether the widget displays a preview of assets from HTTP (non-secure) URLs selected for uploading. Assets from HTTPS URLs will display a preview regardless of this parameter's value.
false
inlineContainer String selector or DOM element Enables embedding the widget inside your web page instead of it appearing as a modal dialog.
null
#my-widget-container
document.getElementById('my-widget-container');
Instance methods
The following methods can be used with the widget object that is returned by one of the Initialization methods:
openRenders an existing widget currently in memory, but that is not currently displayed.
Syntaxopen(source, options)
files
: (Array of strings) Optional asset URLs, in which case the widget either skips directly to uploading the given assets, or skips the source selection options and opens the widget with the given assets ready for cropping (if that option is enabled). Example close
Closes and resets the widget to its initial state without removing it from memory.
Syntaxclose(options)
quiet
: (boolean) When true, skips the confirmation box if the widget is closed while still uploading assets. Default: false. Example update
Updates a widget currently in memory with new options.
Syntaxupdate(options)
The following parameters are
NOTsupported by update:
secure
,
uploadSignature
,
getTags
,
preBatch
,
inlineContainer
, and
fieldName
.
Example hideHides a previously rendered widget while retaining its current state in memory.
Syntaxhide()
Renders a previously hidden widget.
Syntaxshow()
Minimizes the widget.
Syntaxminimize()
Closes the widget and completely removes it from the DOM and memory, freeing up resources. This method returns a promise that is resolved when the cleanup process is finished.
Syntaxdestroy(options)
removeThumbnails
(Boolean) When true, also removes any thumbnails that were displayed after upload. Default: false. Example isShowing
Returns whether the widget is currently visible.
SyntaxisShowing()
Returns whether the widget is currently minimized.
SyntaxisMinimized()
Returns whether the destroy method was called on this instance.
SyntaxisDestroyed()
See
widget eventsin the Upload widget guide for more information on working with events.
The following list details every event fired as well as the corresponding information passed to the result
object:
The user aborted upload.
batch-cancelledThe uploading was cancelled.
closeThe user closed the Upload widget.
display-changedThe display has changed.
publicidThe contents of the public id input field (Advanced options) changed.
queues-endAll files have finished uploading.
queues-startThe files are about to begin uploading.
retryThe user retried after failed uploads.
show-completedThe user clicked the show completed button (requires 'showCompletedButton = true' widget option).
source-changedThe user selected a different source.
successThe upload was successful.
tagsThe contents of the tags input field (Advanced options) changed.
upload-addedA file was selected for upload.
âï¸ Feedback sent!
âï¸Â  ErrorUnfortunately there's been an error sending your feedback.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4