Works with any backend npm install Zero dependencies

Modal Upload

Open a modal dialog for file uploads. The uploader lives inside a centered overlay.

var modal = document.getElementById('uploadModal');
var uploader = new MultipleUpload(el, {
 uploadUrl: '/api/upload'
});

openBtn.addEventListener('click', function() {
 modal.style.display = 'flex';
});
closeBtn.addEventListener('click', function() {
 modal.style.display = 'none';
});

Uploading inside a dialog

The component does not care that it is in a modal — it renders into whatever container it is given. What needs thought is the dialog's own behaviour while an upload is in flight.

Do not let the dialog close the upload

If closing the modal destroys its contents, an in-flight upload dies with it, and the user who clicked outside by accident has no idea why the file vanished. Either keep the uploader alive outside the dialog, or intercept the close and ask — and if the dialog traps focus, make sure the queue and its retry buttons are reachable inside that trap.