Resume Upload
Resume an interrupted chunked upload. When a connection drops, chunks already uploaded are skipped on retry, continuing from where it left off.
var uploader = new MultipleUpload(document.getElementById('demo-resume'), {
uploadUrl: '/api/upload',
multiple: true,
chunked: true,
chunkSize: 1 * 1024 * 1024, // 1 MB for demo
retries: 5,
onTaskError: function(task, error) {
document.getElementById('resume-status').textContent =
'Upload interrupted: ' + error + ' ?will auto-retry';
},
onTaskComplete: function(task) {
document.getElementById('resume-status').textContent =
task.fileName + ' uploaded successfully (resumed if interrupted)';
}
});
Continuing where it stopped
With chunking on, the client can ask the server which chunks it already holds and send only the rest. A 4 GB upload interrupted at 90% resumes as a 400 MB upload rather than starting over.
Two different kinds of resume
Within a session, resume is automatic after a network failure. Across a reload or a crash it needs persistState, and how much survives depends on the adapter: localStorage keeps the bookkeeping so the user re-picks the files, IndexedDB can keep the blobs too and resumes with no user action at all.