File Size Limits
Set minimum and maximum file sizes. Supports human-readable strings.
(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,
minFileSize: '10KB',
maxFileSize: '5MB',
onValidationError: function(msg, name) { log((name||'file') + ': ' + msg); }
});
})();Both ends of the range
maxFileSize defaults to -1 (no limit) and minFileSize to 0. Both accept readable strings as well as byte counts, so '25MB' is equivalent to 26214400.
A minimum is not a strange idea
A maximum protects your storage; a minimum catches a class of user error the maximum cannot — the 0-byte file left behind by a failed export, or the 2 KB placeholder that a camera app writes when a capture goes wrong. Rejecting those at selection time is much kinder than accepting them and failing later in a pipeline.
Client-side limits save a pointless upload; they do not enforce anything. The server has to cap the size while writing bytes rather than trusting a declared length.