Redirect on Complete
Redirect the user to another page after all uploads complete using the onComplete callback. This example shows a countdown before redirect.
new MultipleUpload(document.getElementById('demo-redirect'), {
uploadUrl: '/api/upload',
multiple: true,
onComplete: function(files) {
var msg = document.getElementById('redirect-msg');
msg.style.display = '';
var seconds = 3;
msg.textContent = files.length + ' file(s) uploaded! Redirecting in ' + seconds + 's...';
var timer = setInterval(function() {
seconds--;
if (seconds <= 0) {
clearInterval(timer);
msg.textContent = 'Redirect cancelled (demo mode).';
// In production: window.location.href = '/thank-you';
} else {
msg.textContent = files.length + ' file(s) uploaded! Redirecting in ' + seconds + 's...';
}
}, 1000);
}
});