Package Home / API Reference

API Reference

This reference matches the bundled runtime and TypeScript declarations in this package.

new MultipleUpload(container, options)

Upload Options

OptionTypeDefaultDescription
uploadUrlstring'/api/upload'Single-request upload endpoint.
chunkedbooleanfalseEnables chunked upload flow.
chunkSizenumber5 * 1024 * 1024Chunk size in bytes.
autoUploadbooleantrueStarts uploads as soon as files enter the queue.
multiplebooleanfalseAllows multi-file selection in the file input.
acceptstring''Native file input accept attribute override.
allowedExtensionsstring''Comma-separated extension list such as '.jpg,.png,.pdf'.
allowedMimeTypesstring''Comma-separated MIME patterns such as 'image/*,application/pdf'.
maxFileSizenumber-1Maximum file size in bytes. -1 disables the limit.
minFileSizenumber0Minimum file size in bytes.
maxFilesnumber0Maximum queued files. 0 means unlimited.
concurrencynumber1Number of active uploads allowed at once.
retriesnumber2Retry attempts for failed uploads or chunks.
retryDelaynumber1000Base retry delay in milliseconds.
retryBackoff'linear' | 'exponential''exponential'Retry delay strategy.
timeoutnumber0XHR timeout in milliseconds. 0 disables timeouts.

Display and UI Options

OptionTypeDefaultDescription
dropZoneModebooleanfalseOptimizes the layout for a drop-zone-first UI.
attachmentModebooleanfalseUses a compact attachment list layout.
showFileSizebooleantrueShows file sizes in the queue.
removablebooleantrueShows remove controls for completed items.
showThumbnailsbooleantrueGenerates image and video thumbnails when possible.
thumbnailSizenumber64Preview thumbnail size in pixels.
showToastsbooleantrueEnables built-in toast notifications.
confirmRemovebooleanfalsePrompts before removing queue items.
sortablebooleanfalseFlags the queue as sortable when your UI supports it.
sortBy'priority' | function | nullnullSort strategy for pending tasks.
filterStatusstring | nullnullOnly shows tasks matching a specific status.

Backend, paste, and image pipeline options

OptionTypeDefaultDescription
headersobject | function(task){}Static or per-task request headers.
withCredentialsbooleanfalseSends credentials on cross-origin requests.
fieldNamestring'file'Multipart field name for the upload.
chunkUrlstring | nullnullExplicit chunk upload endpoint.
chunkCompleteUrlstring | nullnullExplicit chunk assembly endpoint.
deleteUrlstring | nullnullOptional endpoint for deleting uploaded files.
responseParserfunction(responseText, task)nullMaps server responses into the expected result object.
methodstring'POST'HTTP method for single-request uploads.
licenseUrlstring | false | nullautoExplicit path to multipleupload.lic. Defaults to a sibling file next to multipleupload.js.
autoLoadLicensebooleantrueAutomatically fetches the license file during startup.
licenseFetchOptionsRequestInit | nullnullOptional fetch settings used when loading multipleupload.lic.
pastebooleantrueEnables clipboard paste support.
pasteTargetstring | HTMLElement | nullnullPaste focus target. Falls back to the uploader container.
fullPageDropbooleanfalseShows a full-page drop overlay when dragging files over the page.
fullPageDropTextstring | nullnullCustom full-page drop overlay text.
imageResizeobject | nullnullResize images before upload.
imageCompressobject | nullnullCompress images to a lower quality level.
imageCropobject | nullnullCrop images before upload.
imageRotatenumber0Rotate images by degrees before upload.
autoOrientbooleanfalseFixes image orientation using EXIF metadata.
watermarkobject | nullnullAdds a text watermark to images.
generateVideoThumbsbooleantrueGenerates thumbnails for supported video files.

Validation, hashing, state, and accessibility

OptionTypeDefaultDescription
preventDuplicatesbooleanfalseBlocks repeated files based on name and size.
validateMimeByMagicbooleanfalseValidates file content via magic bytes instead of only using file.type.
maxImageWidthnumber0Maximum allowed image width. 0 disables the limit.
maxImageHeightnumber0Maximum allowed image height.
minImageWidthnumber0Minimum allowed image width.
minImageHeightnumber0Minimum allowed image height.
customValidationfunction(file, uploader)nullReturns a validation error string or a promise resolving to one.
computeHashbooleanfalseComputes a file checksum before uploading.
hashAlgorithm'crc32' | 'sha256''crc32'Selects the checksum algorithm.
persistStatebooleanfalseSaves completed file metadata in localStorage.
persistKeystring'mu-state'localStorage key for persisted completed file data.
transformPipelinefunction | function[] | nullnullCustom synchronous or asynchronous file transforms.
ariaLabelstring'File uploader'ARIA label applied to the uploader container.
ariaDescribedBystring | nullnullOptional element id for screen-reader descriptions.
localestring'en'Active locale key used by the built-in text labels.

Common Callbacks

CallbackSignatureDescription
onSelect(files, uploader)Return false to cancel selection or a filtered file array to replace the selection.
onProgress(overallProgress, uploader)Overall queue progress updates.
onComplete(completedFiles, uploader)Fires once all active uploads finish.
onError(message, fileName, uploader)General upload or validation errors.
onTaskStart(task, uploader)Individual task started uploading.
onTaskComplete(task, result, uploader)Individual task completed successfully.
onTaskError(task, error, uploader)Individual task failed.
onTaskProgress(task, uploader)Per-file upload progress updates.
onTaskPause / onTaskResume(task, uploader)Pause and resume lifecycle hooks.
onChange(completedFiles, uploader)Completed files list changed.
onQueueRender(tasks, queueEl, uploader)Override or enhance queue rendering.
onPaste(files, uploader)Return false to block pasted files.
onDrop(event, uploader)Receives the original drop event.
onBeforeUpload(task, uploader)Return false to block upload for a task.
onAfterUpload(task, result, uploader)Runs after a task finishes and the result is stored.
onValidationError(message, fileName, uploader)Validation-specific error hook.
onImageProcessed(processedFile, originalFile, uploader)Fires after image transforms run.
onHashComputed(task, hash, uploader)Receives the generated checksum.

Instance Methods and Static Helpers

Chainable instance methods

uploader.upload()
    .pauseAll()
    .resumeAll()
    .clearCompleted();

uploader.getCompletedFiles();
uploader.getStats();
uploader.setOptions({ locale: 'en' });

Static helpers

MultipleUpload.formatSize(bytes);
MultipleUpload.computeSHA256(file);
MultipleUpload.resizeImage(file, 1200, 1200, 0.82);
MultipleUpload.showToast('Saved', 'success');
MultipleUpload.waitForLicense().then(function(info) { console.log(info); });
MultipleUpload.loadLicense('/licenses/multipleupload.lic');
MultipleUpload.getLicenseInfo();
MultipleUpload.registerLocale('fr', strings);