Modal Uploader

Modal Uploader

Open a file uploader inside a Bootstrap modal dialog. The uploader initializes when the modal is shown and uploads work normally within the overlay.

// Initialize uploader when modal opens
modalEl.addEventListener('shown.bs.modal', function () {
 AjaxUploader.create(document.getElementById('modalUploader'), {
 uploadUrl: '/ajaxupload.axd/upload',
 multiple: true,
 autoUpload: true,
 onComplete: function (file) {
 statusEl.textContent = 'Uploaded: ' + file.name;
 }
 });
});