Max Files Limit
Limit how many files can be in the queue at once.
(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,
maxFiles: 3,
autoUpload: false,
onValidationError: function(msg) { log(msg); },
onError: function(msg) { log(msg); }
});
})();Capping the queue
maxFiles defaults to 0, meaning no limit. Set it and files beyond the cap are refused at selection. maxCount is the legacy alias and applies only when maxFiles is absent.
Say the number before they hit it
A limit the user discovers by tripping over it reads as a fault. Put the cap in the interface text and handle the rejection visibly — the difference between “10 files maximum” shown up front and a file that silently fails to appear is the difference between a rule and a bug.