0

I get the original code from here: Using Javascript FileReader with huge files

But my purpose is different, the author wants to get just a part of the whole but I want them all.

I'm trying modify it with loop, mixed with this technique: slice large file into chunks and upload using ajax and html5 FileReader

All fails, is there anyway I can get what I want.

var getSource = function(file) {
    var reader = new FileReader();
        reader.onload = function(e) {
            if (e.target.readyState == FileReader.DONE) {
                process(e.target.result);
            }
        };

        var part = file.slice(0, 1024*1024);
        reader.readAsBinaryString(part);
};

function process(data) {
    // data processes here
}

Thank you,

Community
  • 1
  • 1
ket
  • 945
  • 1
  • 9
  • 15
  • What about it fails? Whats the relevance of the code posted? – Musa Jan 10 '15 at 21:29
  • It does not repeat the process until completed. It stops after getting the getting the first data. – ket Jan 10 '15 at 21:37
  • You're going to have to use a loop, in each iteration slice the required chunk and upload it. – Musa Jan 10 '15 at 21:47

0 Answers0