Works with any backend npm install Zero dependencies

API Reference

Complete reference for MultipleUpload constructor options, methods, events, and CSS customization.

Constructor Options

Pass these options when creating a new MultipleUpload instance.

new MultipleUpload(selector, options)
Option Type Default Description
uploadUrlstring''Server endpoint URL for file uploads
multiplebooleantrueAllow selecting multiple files
autoUploadbooleanfalseStart uploading immediately after file selection
maxFileSizenumber0Maximum file size in bytes (0 = unlimited)
maxFilesnumber0Maximum number of files allowed (0 = unlimited)
allowedTypesstring[][]Allowed MIME types or extensions (e.g. ['image/*', '.pdf'])
chunkSizenumber0Chunk size in bytes for chunked uploads (0 = disabled)
headersobject{}Custom HTTP headers to send with each request
fieldNamestring'file'Form field name for the file
formDataobject{}Additional form data to send with each request
withCredentialsbooleanfalseSend cookies with cross-origin requests
responseParserfunctionnullCustom function to parse server response
thumbnailWidthnumber80Thumbnail preview width in pixels
thumbnailHeightnumber80Thumbnail preview height in pixels
showThumbnailsbooleantrueShow image thumbnails in the file list
showFileSizebooleantrueShow file sizes in the file list
showProgressbooleantrueShow progress bars during upload
dropZoneTextstring'Drag & drop...'Text displayed in the drop zone
browseButtonTextstring'Browse'Text for the browse button
uploadButtonTextstring'Upload'Text for the upload button
enablePastebooleantrueEnable clipboard paste support
attachmentModebooleanfalseUse compact attachment-style display
darkModeboolean|'auto'falseEnable dark mode ('auto' uses system preference)

Methods

Methods available on a MultipleUpload instance.

Method Parameters Returns Description
upload()voidStart uploading all queued files
cancelTask(taskId)stringvoidCancel a specific upload task by ID
removeTask(taskId)stringvoidRemove a task from the queue
cancelAll()voidCancel all active uploads
clearCompleted()voidRemove all completed tasks from the queue
getCompletedFiles()object[]Get array of completed file response objects
getFileGuids()string[]Get array of file GUIDs from completed uploads
addFiles(files)FileList|File[]voidProgrammatically add files to the queue
reset()voidReset the uploader to its initial state

Events / Callbacks

Callback functions passed in the constructor options.

Callback Parameters Description
onSelect(files)File[]Fired when files are selected (before adding to queue)
onProgress(percent)numberOverall upload progress (0-100)
onComplete(responses)object[]All files have finished uploading
onError(error)objectAn upload error occurred
onTaskStart(task)objectAn individual file upload has started
onTaskComplete(task, response)object, objectAn individual file upload completed
onTaskError(task, error)object, objectAn individual file upload failed
onTaskProgress(task, percent)object, numberProgress update for an individual file
onChange(tasks)object[]The task queue has changed
onInit(instance)MultipleUploadComponent has been initialized
onQueueRender(queue)HTMLElementThe queue UI has been re-rendered
onPaste(files)File[]Files pasted from clipboard

CSS Variables

Override these CSS custom properties to theme the component.

Variable Default Description
--mu-font-familyinheritFont family for all text
--mu-font-size14pxBase font size
--mu-color-primary#0891b2Primary accent color
--mu-color-success#16a34aSuccess state color
--mu-color-error#dc2626Error state color
--mu-color-text#334155Primary text color
--mu-color-text-muted#94a3b8Secondary/muted text color
--mu-color-bg#ffffffComponent background color
--mu-color-border#e2e8f0Border color
--mu-color-drop-bg#f8fafcDrop zone background color
--mu-color-drop-hover#ecfeffDrop zone hover/active background
--mu-color-progress-bg#e2e8f0Progress bar track background
--mu-color-progress#0891b2Progress bar fill color
--mu-border-radius8pxBorder radius for the component
--mu-border-radius-item6pxBorder radius for file list items
--mu-spacing12pxBase spacing unit
--mu-thumbnail-size48pxThumbnail dimensions

CSS Classes

Classes applied to the component elements. Use these for custom styling or overrides.

Class Element Description
.mu-upload-areaContainerRoot container element
.mu-drop-zoneDrop zoneThe drag-and-drop target area
.mu-drop-zone-activeDrop zoneApplied when files are dragged over
.mu-drop-textTextInstruction text inside drop zone
.mu-drop-iconIconIcon inside the drop zone
.mu-file-listList containerContainer for all file items
.mu-file-itemFile rowIndividual file entry in the queue
.mu-file-nameTextFile name display
.mu-file-sizeTextFile size display
.mu-file-thumbImageThumbnail preview image
.mu-progressProgressProgress bar container
.mu-progress-barProgressProgress bar fill element
.mu-statusStatusStatus text (uploading, complete, error)
.mu-btn-cancelButtonCancel button for a file item
.mu-btn-removeButtonRemove button for a file item
.mu-btn-uploadButtonUpload button (when autoUpload is false)
.mu-btn-browseButtonBrowse files button
.mu-darkContainerApplied when dark mode is enabled
.mu-attachmentContainerApplied in attachment mode

TaskStatus Enum

Possible status values for upload tasks.

Value Description
'queued'File is in the queue, waiting to upload
'uploading'File is currently being uploaded
'complete'File uploaded successfully
'error'Upload failed with an error
'cancelled'Upload was cancelled by the user