Skip to content

Instantly share code, notes, and snippets.

@savroff
Last active March 3, 2017 15:21
Show Gist options
  • Save savroff/1c8593fdcd3327748613 to your computer and use it in GitHub Desktop.
Save savroff/1c8593fdcd3327748613 to your computer and use it in GitHub Desktop.
Resumable uploading with plupload
// If you want to create resumable uploading for your chunks plupload uploader
// you need to go in plupload.dev.js on line 1419 in xhr.onload function
// and change this part:
offset += curChunkSize;
file.loaded = Math.min(offset, blob.size);
// to this:
offset += curChunkSize;
var serverOffset = parseInt(xhr.responseText);
if (serverOffset > offset) {
offset = serverOffset;
}
file.loaded = Math.min(offset, blob.size);
// after it you need to setup you backend server to answer correct
// current size of already uploaded info in json responce
// and now your uploader try to upload first chunk and resume uploading from needed chunk.
// Enjoy :)
@roboticsexpert
Copy link

hi .
i think i need a server side example for you solution. i did every thing , but for resuming i have problem...i use php for my server side but i know ruby... can you show me your server side code ? @savroff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment