Last active
March 3, 2017 15:21
-
-
Save savroff/1c8593fdcd3327748613 to your computer and use it in GitHub Desktop.
Resumable uploading with plupload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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