Error Recovery
Handle upload errors gracefully and offer automatic retry using the onTaskError callback.
Drag & drop files here
Error log will appear here...
var uploader = new MultipleUpload(document.getElementById('myUploader'), {
uploadUrl: '/api/upload',
maxRetries: 3,
retryDelay: 2000,
onTaskError: function(task, error) {
console.log('Error on file: ' + task.name + ' ?' + error.message);
// task.retry() is called automatically when maxRetries > 0
},
onTaskRetry: function(task, attempt) {
console.log('Retry attempt ' + attempt + ' for ' + task.name);
}
});
Retries you get for free
retries defaults to 2 with retryDelay at 1000 ms and exponential backoff, so most transient failures resolve without the user knowing there was one. onTaskError and onTaskRetry are how you observe it happening.
What to do when they run out
Automatic retries only cover the transient case. Once they are exhausted the file needs a manual retry the user can reach, and a message that distinguishes the causes: a network problem is worth trying again, a file the server refused is not. Offering “retry” for a permanent rejection just produces the same failure more slowly.