Works with any backend npm install Zero dependencies

onSelect File Filtering

Use the onSelect callback to inspect, filter, or reject files before they enter the queue.

(function() {
 var logEl = document.getElementById('log');
 function log(m) { var d = document.createElement('div'); d.className='pkg-log-entry'; d.textContent=m; logEl.appendChild(d); logEl.scrollTop=logEl.scrollHeight; }
 new MultipleUpload('#demo', {
 uploadUrl: '/api/upload',
 multiple: true,
 autoUpload: false,
 onSelect: function(files, uploader) {
 log('Selected ' + files.length + ' file(s)');
 var filtered = files.filter(function(f) { return f.size < 5 * 1024 * 1024; });
 if (filtered.length < files.length) log('Filtered out ' + (files.length - filtered.length) + ' file(s) over 5MB');
 return filtered;
 }
 });
})();

Inspecting the selection as a whole

onSelect fires with the files the user just chose, before they are added individually. That is the only point where you can see the batch as a batch — useful for rules about combinations rather than about single files.

The rules a per-file check cannot express

“Total under 50 MB”, “at most one PDF”, “these two documents must arrive together”: none of them can be decided while looking at one file. Per-file limits still do the simple work; this is where the rest belongs.