Preloaded Files
Display previously uploaded files when the page loads, useful for edit forms.
(function() {
new MultipleUpload('#demo', {
uploadUrl: '/api/upload',
multiple: true,
removable: true,
preloadedFiles: [
{ fileName: 'report-2024.pdf', fileSize: 245760, guid: 'abc-123', contentType: 'application/pdf' },
{ fileName: 'photo.jpg', fileSize: 1048576, guid: 'def-456', contentType: 'image/jpeg', thumbnailUrl: 'https://picsum.photos/seed/mu1/120/120' },
{ fileName: 'spreadsheet.xlsx', fileSize: 51200, guid: 'ghi-789', contentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }
]
});
})();
Starting with files already there
An edit form usually has attachments from last time. Pre-loading them puts those files in the queue as completed entries, so the user sees one list containing both what already exists and what they are adding now, rather than two separate interfaces.
They are references, not uploads
A pre-loaded entry stands for a file the server already holds, so removing one has to be handled as a delete on your side — it never had an upload to cancel. Keeping that distinction straight is what stops an edit form from silently detaching files the user never touched.