Works with any backend npm install Zero dependencies

Async Validation (Promise)

Return a Promise from customValidation for server-side or async checks.

(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,
 customValidation: function(file) {
 log('Checking ' + file.name + '...');
 return new Promise(function(resolve) {
 setTimeout(function() {
 if (file.size > 10 * 1024 * 1024) {
 resolve('File exceeds 10 MB policy limit.');
 } else {
 log(file.name + ' passed async check');
 resolve(null);
 }
 }, 500);
 });
 },
 onValidationError: function(msg, name) { log((name||'file') + ': ' + msg); }
 });
})();