JavaScript API — Upload Dialog and Panel

  • This documentation is for the version 3.7.0 of the widget. If you're looking for the JavaScript for Widget v2 docs, check here.

Upload Dialog is a modal window on top of your page. It contains a set of tabs with different upload sources and file preview. Upload Panel is the same thing, just in a non-modal form.

Open Upload Dialog

You can use openDialog to open a standalone upload dialog over your page,

var dialog = uploadcare.openDialog(files, tab, settings);


  • files, a file, file array or group that will be shown as already uploaded.
  • tab, a name of a tab opened by default when no predefined files are present.
  • settings, a settings object.

Open Upload Panel

openPanel is used to open an upload panel at any point on your page,

var panel = uploadcare.openPanel(placeholder, files, tab, settings);


  • placeholder, a selector or DOM element that will be replaced with an upload panel. This will be put back on your panel resolving.
  • settings, settings object.

Dialog API

Both dialog and panel instances implement the extended jQuery promise interface showing progress on a user tab.

dialog.done(function(result) {
  // Dialog closed and a file or file group is selected.
}); {
  // Dialog closed and no file or file group was selected.
  // The result argument is either null or the last selected file.

dialog.always(function() {
  // Handles a closing dialog regardless of whether or not files were selected.

dialog.progress(function(tabName) {
  // tabName is selected. progress() works when you click a tab name on the list.
  // Technically, it would work on any dialog progress, i.e. when preview appears.

In addition to the jQuery promise interface, dialog and panel objects have the following properties and methods,

resolve()methodResolve a dialog with currently selected files.
reject()methodClose the dialog and discard any file selection.
addFiles()methodAdd an array of files to your dialog result set.

Switch your dialog to a tab with a provided name. The name you provide should be present in the settings.tabs array.

fileCollcollectionA collection of selected files. Use it to subsribe and change events.
hideTab()methodHide a tab with a provided name.
showTab()methodShow a tab with a provided name.
isTabVisible()methodInquire if a tab with a provided name is visible.

Register a callback that will be called when tab visibility gets changed. “hideTab()” and “showTab()” provide tab visibility changes. Another example of a changing visibility would be Preview Tab. The first argument stands for the tab name, and the second is a boolean related to tab visibility.

You can find more customization examples here.

We’re always happy to help with code, integration, and other stuff. Search our site for more info or post your question in our Community Area.