Modal Upload
Open an upload dialog in a modal overlay. The uploader is initialized when the modal opens and files are uploaded within the modal context. Useful for adding attachments without leaving the current page.
What you should see: the uploader inside a dialog, keeping focus trapped while it is open and returning focus to the trigger when it closes. Accepts documents and archives up to 20 MB.
<button id="open-modal">Open Upload Modal</button>
<div id="upload-modal" style="display:none;">
<core-upload asp-upload-url="/api/upload/upload/multiple"
asp-multiple="true"
asp-drop-zone="true"
asp-progress="true"
asp-thumbnails="true"
asp-auto-upload="true"
asp-on-complete="onModalUploadComplete">
</core-upload>
</div>
<script>
function onModalUploadComplete(file, response) {
console.log('Uploaded in modal:', file.name);
}
document.getElementById('open-modal').onclick = function() {
document.getElementById('upload-modal').style.display = 'flex';
};
</script>