Redirect After Upload
Redirect to a different page after all files finish uploading. Common for form submission workflows.
What you should see: the page navigates once every file has finished, not once per file — the redirect is fired from the queue-complete event.
Upload a file to trigger the redirect. This demo redirects back to /Demos after completion.
var uploader = CoreUpload.create('#redirect-uploader', {
uploadUrl: '/api/upload/upload',
multiple: true,
autoUpload: true,
onTaskComplete: function(file) {
console.log('Uploaded: ' + file.name);
},
onQueueComplete: function(files) {
// Redirect after all files are uploaded
window.location.href = '/Demos';
}
}); Moving on when the queue drains
The completion callback is the natural place to navigate: to the record, to the next step, or simply to refresh a list. It fires once everything in the queue has settled.
Settled includes failed
The queue completes when nothing is left in flight, and that includes files that failed and exhausted their retries. Redirecting unconditionally takes the user away from the only screen that could have told them two attachments did not upload.