Image & Video APIs

Upload widget

Last updated: Nov-24-2025

Cloudinary's Upload widget is a complete, interactive user interface that enables your users to upload files from a variety of sources to your website or application. The widget, requiring just a couple lines of code to integrate, eliminates the need to develop in-house interactive media upload capabilities.

This guide describes the latest version of the Cloudinary Upload widget.

Note
The Cloudinary Upload widget, when configured with an accessible color theme, is designed to provide an inclusive asset sharing experience that meets WCAG 2.1 AA compliance. The Web Content Accessibility Guidelines (WCAG) are an internationally recognized set of recommendations for making web content more accessible to people with disabilities. These guidelines ensure that users with visual, auditory, motor, and cognitive impairments can fully engage with digital content through assistive technologies, keyboard navigation, and other accessibility-friendly enhancements. For more information, see Accessibility.

Important

Cloudinary supports only the documented configuration and the supplied files with the widget. Any direct changes to the widget code and its elements (for example, CSS and JS files) might break its functionality, and will not be supported.

Upload widget main screen

The Upload widget responsively resizes to fit in the available width, with the display functionality automatically adjusting on the fly for use in mobile applications.

Upload widget main screen

The widget offers uploading from a variety of sources, such as: your local device, a remote URL, the device camera, image search, popular social media accounts and a variety of stock photography sites. The widget supports drag & drop functionality, interactive cropping, upload progress indication, and thumbnail previews. The widget also monitors and handles uploading errors and offers extensive event handling for integrating your own code.

You can implement the widget for unsigned uploading directly from the browser to Cloudinary storage, without involving your servers in the process. The widget sends JavaScript callbacks on successful uploads, so you can integrate the upload process back into your existing media pipeline. You can additionally configure Cloudinary to send server-side callbacks. Advanced users can also use the Upload widget with signed uploads for a more secure process when required.

Once uploaded, images and videos can be resized, cropped and transformed by Cloudinary on the fly so they can be embedded as needed in your website or mobile app.

The Upload widget requires only pure JavaScript to integrate and is easy to use within any web development framework.

Quick example

To use Cloudinary's Upload widget in your site with unsigned uploads, include the widget's remote JavaScript file and then specify the following (minimum) information when calling the createUploadWidget method to initialize the widget:

  • Your product environment cloud name
  • The upload preset to use for uploading files

Once initialized, the widget is ready to be rendered when needed. The following sample includes code for binding to the click event of a button element in a web page, in order to call the widget's open method and display the initialized widget:

You can try out this simple Upload widget example by clicking the button below:

The following buttons were implemented with a few additional parameters to demonstrate additional capabilities.

These and many additional options are described on the rest of this page.

Tip
Take a look at the profile picture sample project, which demonstrates the use of the Upload widget in a Next.js app.

Code explorers

Code explorer: Basic Upload widget

Check out the following Upload widget code explorer that you can fork to try out some sample configuration changes:

Note
Due to CORS issues with StackBlitz, you may have errors opening the widget with the preview. Try opening the preview in a new tab to resolve this or use the GitHub link below to run locally.

This code is also available in GitHub.

Try this code explorer in other frameworks:

Tip
Enjoy interactive learning? Check out more code explorers!

For implementation instructions, see Unsigned uploads.

Sample project: Signed uploads using the Upload widget

This Node.js app demonstrates how to perform a signed upload using the Upload widget. The widget is constructed in signed-uploads/public/js/uploadclientwidget.js and the signature is generated in signed-uploads/modules/signuploadwidget.js, using the api_sign_request method.

Setup instructions (after cloning from GitHub)

  1. Install all dependencies from the top level:

  2. Open signed-uploads/public/js/config.js

  3. Set cloud_name, api_key and api_secret with the corresponding account details from the API Keys page of the Console Settings.

  4. Run the app to start the server:

    The response should be:

  5. Open http://localhost:3000 in a browser.

Go to GitHub to try it out:


For implementation instructions, see Signed uploads.

Cloudinary Upload widget video tutorial

This video demonstrates how to integrate a basic Upload widget using a code sandbox.

This video is brought to you by Cloudinary's video player - embed your own!
Use the controls to set the playback speed, navigate to chapters of interest and select subtitles in your preferred language.

How to set up and integrate the Upload widget

For most needs, you can set up the Upload widget for unsigned uploads. Using unsigned uploads with your widget makes it quick and simple for you to provide a UI where users can upload content to your site.

Signed uploads require a bit more setup and coding, but provide a more secure upload process when required.

Tip
You can use the Cloudinary CLI to generate the basic code for an Upload widget:

Unsigned uploads

Unsigned uploads are somewhat less secure than signed uploads. For example, it is possible for a customer to inspect your client-side HTML code to find your cloud name and preset, and use that information to upload unwanted files to your Cloudinary product environment. For this reason, unsigned uploads have some protective limitations. For example, existing assets can't be overwritten. The options you set in the unsigned preset can also limit the size or type of files that users can upload to your Cloudinary product environment using that preset.

To setup and add an Upload widget for unsigned uploads:

1. Include the Cloudinary widget JavaScript file in your web page

You can choose between always importing the latest version of the Upload widget or importing a specific version:

Important
  • We generally recommend including the latest version to ensure that your users always get the latest fixes and functionality.

    However, if you want to maintain more control over the pace of updates, you can test and use a specific version. In this case, we recommend that you watch the Upload widget changelog (or register for the Upload widget changelog RSS feed) and regularly test and upgrade to the latest versions.
  • When using both the Upload Widget and Video Player on the same page, the video player scripts must be loaded first to prevent any conflicts.

2. Optional. Set your cloud name globally

If you include multiple widgets in your web page, you can use the setCloudName method to instruct all widgets on the page to upload to the same Cloudinary product environment.

Alternatively, you can set the product environment cloud_name as a parameter of each widget creation call.

3. Create an unsigned upload preset

  1. In the Upload section of the Console Settings, create a new, unsigned upload preset. This preset serves as a form of security override, allowing client-side unsigned uploads.

    Alternatively, you can create an unsigned upload preset using the Admin API or in your LLM-based IDE using the Cloudinary Asset Management MCP server.

  2. Note the preset name. You'll need it in your widget creation call, step 4.
  3. Optional. Edit the preset to:
    • Modify its name
    • Apply incoming transformations to control the size or type of asset users can upload using your widget
    • Automatically generate certain eager transformations on all uploaded assets

For details, see Upload presets.

4. Add your widget

  1. Use one of the widget initialization methods to create your widget.
  2. When you call the method, specify:
    • uploadPreset - The preset name you created in step 3
    • cloudName - Your cloud name (if you did not set it globally)
    • Any additional widget options you want to apply

For example, in the demo example earlier on this page, the createUploadWidget method call includes the cropping option, which enables users to define cropping coordinates, and the folder option, which uploads all images from the widget to a specified folder:

Signed uploads

Instead of providing an upload preset name, you initialize the widget for signed uploads with the public API key and an upload signature that is generated either when the page is loaded or when the upload request is submitted.

To setup and implement the Upload widget for signed uploads:

1. Include the Cloudinary widget JavaScript file in your web page

You can choose between always importing the latest version of the Upload widget or importing a specific version:

Important
  • We generally recommend including the latest version to ensure that your users always get the latest fixes and functionality.

    However, if you want to maintain more control over the pace of updates, you can test and use a specific version. In this case, we recommend that you watch the Upload widget changelog (or register for the Upload widget changelog RSS feed) and regularly test and upgrade to the latest versions.
  • When using both the Upload Widget and Video Player on the same page, the video player scripts must be loaded first to prevent any conflicts.

2. Optional. Set your cloud name globally

If you include multiple widgets in your web page, you can use the setCloudName method to instruct all widgets on the page to upload to the same Cloudinary product environment.

Alternatively, you can set the product environment cloud_name as a parameter of each widget creation call.

3. Optional. Create a signed upload preset

When you use the Upload widget for signed uploads, an upload preset isn't mandatory. However, you can optionally create a signed preset if you want to define incoming or eager transformations on the uploaded asset.

  1. Define the signed upload preset as described in Upload presets.
  2. Supply the preset name in the uploadPreset option when you call the widget initialization method in step 5.

4. Select string or function as the upload_signature type and prepare the required code

Select one of the following options and prepare the required code:

Option A: String signature

Use this option when all parameters required for signing are known at page load time.

Characteristics:

  • Requires your page to connect to the web server on page load to generate the signature.
  • Requires that all parameters required for signing are known at page load time. If user input will affect the parameters (for example, if you are using the widget's interactive cropping option), you must use Option B: Function signature.
  • The signature is valid for one hour from the timestamp used in the signature. If a user keeps the page open for a long time, the signature string may expire.

To prepare a string signature:

  • Generate the signature string from all parameters used, including source=uw.

    The source=uw is a hidden parameter sent automatically by the Upload widget, but must still be included in the string to sign.

    For example:

Note
The parameters in the string to sign need to be serialized in alphabetical order and require snake_case, which is in contrast to the camelCase used for the widget parameters. For details on generating the signature string, see Generating authentication signatures.

Option B: Function signature

Use this option when user interaction will affect upload parameters.

Characteristics:

  • Requires you to create a function to generate the signature.
  • The function runs when the upload request is submitted, therefore, the timestamp does not risk expiring if the user keeps the page open.
  • The function receives the final parameters of the upload, including any parameters impacted by user interaction.

To prepare a function signature:

  • Create a function that uses a server-side endpoint to generate the signature.

    For example: A function that uses a server-side endpoint to generate the signature:

Important
You must use the timestamp value provided by the widget (passed in params_to_sign) and not create your own timestamp value.

5. Add your widget

  1. Use one of the widget initialization methods to create your widget.
  2. When you call the method, specify:
    • api_key - Your API key
    • cloudName - Your cloud name (if you did not set it globally)
    • uploadSignature - The string or function from step 4
    • uploadSignatureTimestamp - For string signatures only
    • Any additional widget options you want to apply

For example, the applyUploadWidget method creates the Upload widget and calls the signature function shown in the previous step:

Third-party upload sources

In addition to the 'My Files', 'Web Address', and 'Camera' sources, the Upload widget supports a variety of third‑party upload sources from which your users can upload images and videos.

Upload widget sources

Desktop source tabs:

  • If there are more sources than fit within the widget width, carousel arrows appear for horizontal scrolling.
  • The number of visible sources depends on the length of their labels. With default text, about 7–8 sources fit without scrolling.
  • If you customize or translate the labels, the number of visible sources may change accordingly.

Mobile display:

At responsive widths narrower than 768px, the widget switches to the mobile display with a collapsible side menu.

Upload widget main screen

The sources parameter

The sources parameter defines which upload options appear in the Upload Widget, and allows you to configure those options. Provide an array of strings, where each value adds a corresponding upload tab or option.

If you don’t include the sources parameter, all available sources are shown by default.

To customize the sources available in your Upload widget:

Include the sources parameter when creating the Upload Widget and specify the sources you want to enable:

  • List the source values in the order you want them to appear.
  • Select from the following possible values:
Value Description
local Upload a file from your local device. Adds the My Files source option.
url Upload a file from a remote location. Adds the Web Address source option.
camera Upload an image file via the device's camera. Adds the Camera source option.

Note: Desktop/laptop only - a mobile device's camera is accessed through the local (My Files) source option.
dropbox Upload a file from your Dropbox account. Adds the Dropbox source option.
image_search Upload a file from the web using Google's Search Engine. Adds the Image Search source option.
shutterstock Upload an image from a Shutterstock account. Adds the Shutterstock source option.
gettyimages Upload an image from a Getty Images account. Adds the gettyimages source option.
istock Upload an image from an iStock account. Adds the iStock source option.
unsplash Upload an image from Unsplash. Adds the Unsplash source option.
google_drive Upload a file from a Google Drive account. Adds the Google Drive source option.

Image Search source

The image_search option allows your users to select images from the web using your Google Custom Search account, and then upload them to Cloudinary. The search can be optionally confined to specific sites (e.g., your own website) and can be filtered by specified licensing criteria.

Image Search option

Important
To enable this search option, you must obtain an API Key from Google. The API Key is free to use within certain search rate limits, and there are various large scale commercial options as well. To enable Google Custom Search and generate your API Key see https://developers.google.com/custom-search/json-api/v1/overview.

To include Image Search in your customized sources:

  1. Add the googleApiKey parameter with the API key for your Google Custom Search account.
  2. Add the sources parameter (array of strings) to customize the available upload options and include the image_search source.
  3. Optional. Add the searchBySites parameter (array of strings) with the domain names of sites you want to allow for the search:
    • If more than one site is specified, a Search by Site drop-down will be added so your users can select the site to search.
    • To allow searching the entire web, use the value all (default).
  4. Optional. Add the searchByRights parameter and set to true to add a drop-down box so that users can select a licensing filter to apply to the image search (default: false).

Basic example:

Example with sites filter and rights filter:

Image Search select

Dropbox source

The dropbox option allows your users to login to their own Dropbox account, browse through their folders and files, and then select the files to upload to Cloudinary. This option requires that the Upload widget is embedded in a secure (HTTPS) page because the user sign-in to Dropbox must be over a secure connection.

To include Dropbox in your customized source:

  1. Create a new app on the Dropbox App Console:
    • Click My apps
    • Select the Dropbox API and Full Dropbox options
    • Name your app
    • Click the Create app button
  2. On the next page, set the following redirect URI for your Dropbox application: https://widget.cloudinary.com/v2.0/global/auth/index.html
  3. Copy the auto-generated App key for your Dropbox app. You will supply it as the value of the dropboxAppKey parameter in step 5.
  4. Set your Dropbox app status:
    • Your Dropbox app is initially created in Development status for testing purposes.
    • You can enable additional users with the Enable additional users button.
    • When your app is ready to go live, click Apply for Production status to enable all your users to upload via the Dropbox app.
    • For more information on creating Dropbox apps, see their documentation and take note of their branding guidelines.
Dropbox SUBTITLE_2

  1. Configure the Dropbox source in your Upload widget by adding the following parameters to the method you use for creating the Upload widget:
    • dropboxAppKey (String) - The App key from step 3.
    • sources (Array of strings) - Use this parameter to customize available sources, and include dropbox in the array to add the Dropbox option.

For example:

Shutterstock source

The shutterstock option allows your users to log in to their own Shutterstock account, browse the assets and then select the ones to upload to Cloudinary. If they haven't yet purchased the Shutterstock asset they select, they can purchase it as part of this process.

Shutterstock login

To include Shutterstock in your customized sources:

Add the sources parameter (array of strings) to customize available sources, and include shutterstock in the array to add the Shutterstock option,

For example:

Getty Images source

The gettyimages option allows your users to log in to their own Getty Images account, browse the assets and then select the ones to upload to Cloudinary. If they have not yet purchased the asset they select, they can purchase it as part of this process.

gettyimages login

To include Getty Images in your customized sources:

Add the sources parameter (array of strings) to customize available sources, and include gettyimages in the array to add the Getty Images option.

For example:

iStock source

The istock option allows your users to log in to their own iStock account, browse the assets and then select the ones to upload to Cloudinary. If they haven't yet purchased the iStock asset they select, they can purchase it as part of this process.

iStock login

To include iStock in your customized sources:

Add the sources parameter (array of strings) to customize available sources, and include istock in the array to add the iStock option.

For example:

Unsplash source

The unsplash option allows your users to browse the assets on Unsplash, and then select the ones to upload to your Cloudinary account.

Unsplash login

To include Unsplash in your customized sources:

Add the sources parameter (array of strings) to customize available sources, and include unsplash in the array to add the Unsplash option.

For example:

Note
Some of the Unsplash filters are available only after conducting a textual search.

Google Drive source

The google_drive option allows your users to login to their own Google Drive account, browse through their files and then select the files to upload to Cloudinary.

Google Drive source

To include the Google Drive in your customized sources:

  1. Add the sources parameter (array of strings) to customize available sources, and include google_drive in the array to add the Google Drive option.
  2. Optional. Add the googleDriveClientId parameter (string) with the Client ID of your own Google Drive application for accessing your users' Google Drive accounts. If not provided, uses the Cloudinary Google Drive app.

For example:

Note
The Google Drive source is not supported by either Internet Explorer 11 or by Safari browsers.

API events

The Upload widget methods include a callback function for implementing event handling.

To implement event handling in your Upload widget:

  1. Add a callback function with the signature: function(error, result), where:
    • error - Either null if successful or an error message if there was a failure
    • result - A JSON object detailing the triggered event
  2. In your callback function, check for specific events and handle them accordingly.

For example, to log a message to the console when a user clicks the 'show completed' button:

For a full listing of available events, see the Events section in the Upload widget API reference.

Pre-batch validation

You can run validation on the files in the upload queue before they are uploaded to Cloudinary.

To implement pre-batch validation:

  1. Add preBatch to the widget configuration

    Provide a function with the signature (cb, data).

  2. Run your validation logic inside the preBatch function

    Check data.files and then choose whether to continue or cancel the upload:

    • Cancel: call cb({ cancel: true })
    • Proceed: call cb()

For example, to cancel the upload if the file name is 'TopSecret':

Prepare upload parameters

You can prepare upload parameters for files in the upload queue before they're uploaded to Cloudinary. Use this to specify tags, metadata for each file, or prepare an upload signature for a signed upload.

To prepare upload parameters:

  1. Set the prepareUploadParams parameter with a function to run before the upload.
  2. In your function, prepare any upload parameters you need (see supported parameters in the note below).
  3. Call the callback function with the prepared parameters.

The following example prepares an upload signature for a signed upload:

Notes
  • 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.
  • If the prepareUploadParmas parameter is included then the uploadSignature parameter is ignored. If you also need to provide a signature, make sure to include that code in your prepareUploadParams function and pass the signature as part of the data passed to the callback (cb).
  • If the code in your function determines that the upload should be canceled, you can include the cancel boolean parameter set to true when calling the callback function (the same way you can cancel the upload with Pre-batch validation).

Tagging suggestions

You can add tagging suggestions that appear while your users are typing in the Add a Tag (Advanced options) text field.

To enable tagging suggestions:

  1. Create a function that's called whenever the text changes in the field. Your function should call the callback function with the list of tagging suggestions to display.
  2. Add the getTags parameter with the function to call.
  3. Set the showAdvancedOptions parameter to true.

The following example demonstrates a mini auto-complete function that returns only suggestions matching the current text entered in the field:

Here's the Upload widget with tagging enabled:

Upload widget - tagging

Upload preset selection

You can offer your users an additional Advanced option with a selection of Upload Presets to choose from.

To enable upload preset selection:

  1. Create a function that is called to provide the list of presets to offer. Your function should call the callback function with the list of presets to display.
  2. Add the getUploadPresets parameter with the function to call.
  3. Set the showAdvancedOptions parameter to true.

The following example demonstrates an upload preset selection function that returns 3 presets:

Here's the Upload widget with upload preset selection enabled:

Upload widget - upload preset selection

Webhook notifications

If you are implementing the widget and also need to process upload information in your server-side code, you can set up notifications.

To receive server-side webhook notifications of widget uploads:

  1. Include a notification URL in the upload preset you use for the widget.
  2. Create a server-side endpoint to receive the notification.
  3. In your endpoint, parse the response from the widget upload.
  4. Process the upload information as needed (e.g., store in database, trigger workflows).

In the following Python example, the widget response is used to store the image model:

Look and feel customization

The look & feel of the Upload widget can be fully customized. You can modify the colors, fonts, and other elements.

To customize the Upload widget appearance:

  1. Add the styles parameter to your widget creation method with a JSON structure defining the elements to override.
  2. Within the styles parameter, specify:
    • palette - To define the colors of the various elements as an RGB or RGBA hex triplet or quadruplet, or a 3- or 4-digit RGB/RGBA hex
    • fonts - To define the font to use for all the text elements (currently only supports fonts from Google available via fonts.googleapis.com)
  3. Include only the elements you want to override (all other elements will use default values).

The following example sets all elements to their default values (for reference purposes):

Tip
Use the Upload widget Demo page to visualize the Upload widget customization options. You can select the pre-defined Accessible theme that meets WCAG 2.1 AA compliance, or choose any colors you like. When you're happy with the colors you selected, Copy the palette customization code to the clipboard.

Accessibility

Web accessibility ensures that your website is inclusive for all visitors, including those with disabilities. The Web Content Accessibility Guidelines (WCAG) 2.1 AA provide an internationally recognized standard for making digital content accessible.

The Cloudinary Upload widget is designed to meet these accessibility requirements. It includes built-in support for keyboard navigation, screen readers, and low-vision use cases (requires configuration), all without requiring changes to your core workflows.

Accessible Upload widget

Note
Cloudinary offers additional tools and best practices to help make the media on your website or app more accessible. For guidance on captions, alt text, and other accessibility features, see our Accessibility guide.

Motor and mobility support

For users who rely on a keyboard instead of a mouse, the Upload widget is fully navigable:

  • Keyboard navigation: Users can reach images and items in scrollable regions using Tab and Shift+Tab, following a logical and predictable focus order.

    • This includes interactive items within scrollable regions, buttons, tabs, and other controls.
    • Enter activates the currently focused element.
  • Focus management: When panels open (e.g., filter results), focus moves automatically to the first control in the panel and stays within that panel until it closes, ensuring users never lose context or accidentally navigate behind an active modal.

Note
On the preview screen, keyboard-based cropping is not currently supported.

Support for screen readers

For users with sight disabilities, it's critical that assistive technologies are able to interpreted the interface accurately. The Upload widget provides semantic markup, accessible names, and other features to support this:

  • All form controls have programmatically associated labels.

  • Actionable elements, such as buttons and links, expose clear, descriptive names.

  • Informative images include alternative text, while decorative images are marked to be ignored.

  • Lists use semantic containers (<ul>, <ol>), and landmarks are uniquely named to make navigation more efficient with screen readers.

  • Filter results display in a live region so that screen reader users are aware of changes without needing to move focus.

Support for low vision and color blindness

For users with low vision or color-vision deficiencies:

  • Zoom and scaling: Users can enlarge text and interface elements as needed, ensuring they can comfortably read and interact with the widget.

  • Color and contrast: You can configure an accessible color theme with sufficient contrast by.

To configure an accessible color theme:

  1. Go to the Upload widget Demo page.
  2. In the Theme dropdown, select the predefined Accessible theme.
  3. Copy the generated Upload Widget instantiation code and paste it into your app to use the accessible color palette.

OR

Define your own accessible palette programmatically.

Example: Upload widget configuration with the Accessible theme applied

See also: Cloudinary Upload widget in the Accessibility guide.

Localization

The text used in the Upload widget can be fully customized for different languages.

To localize the Upload widget:

  1. Add the text parameter with a JSON structure defining the value to use for each text element in each language.
  2. Add the language parameter to specify which language to use from those defined in the text parameter (default: en).
  3. Specify any elements from the upload widget text.json that you want to override. Any element you don't specify will use the default values shown in that file.

For example, to customize only the queue title, queue title_uploading_with_counter, and the crop title:

Note
Elements that support a variable value (specified inside double braces {{...}}) are replaced with the actual value at runtime. Only the elements that already contain the double braces in the default localization file support variables.

Encryption

Files can be encrypted and then uploaded to Cloudinary as raw files. These files cannot be previewed within Cloudinary and will need to be decrypted after downloading them.

To enable file encryption in the Upload widget:

  1. Add the encryption parameter to your widget creation method.
  2. Within the encryption parameter, specify:
    • key - Your encryption key
    • iv - Your initialization vector

The widget uses the browser's AES-GCM TextEncoder encryption with the SubtleCrypto library.

For example:

Decryption

Files that are uploaded and encrypted by the widget can be decrypted using the AES-GCM SubtleCrypto library.

To decrypt a file that was encrypted by the Upload widget:

  1. Use the AES-GCM SubtleCrypto library's decrypt method.
  2. Pass the following parameters to the decrypt method:
    • key - The same encryption key used when uploading the file
    • iv - The same initialization vector used when uploading the file
    • buffer - The file in base64 format

The decrypt method signature:

For example, using the decrypt method that passes the "dog.jpg" file in base64 format, a key of "ff234fe526725753fa45b53325", and an iv of "cd8a46d72e26a365dca78ef":

Upload widget reference

For details on all the available methods, parameters and events, see the Upload widget reference.

✔️ Feedback sent!

Rate this page: