There are some nice examples of loading files in HTML5 Rocks , but there is something that is not enough for me.
As far as I can see, the download monitoring example code also notes that this is useful when we upload large files.
I'm sure without slicing the file? I mean server problems, memory, etc. Chrome doesn't support File.slice()at the moment, and I don't want to use a bloated jQuery plugin if possible.
File.slice()
Chrome FF File.slice(), File.webkitSlice() File.mozSlice(), . , .zip . :
File.webkitSlice()
File.mozSlice()
Blob.webkitSlice( in long long start, in long long end, in DOMString contentType );
, ? , , . HTML5Rocks . - . 500 , 99%:)
, blobs:
function readBlob() { var files = document.getElementById('files').files; var file = files[0]; var ONEMEGABYTE = 1048576; var start = 0; var stop = ONEMEGABYTE; var remainder = file.size % ONEMEGABYTE; var blkcount = Math.floor(file.size / ONEMEGABYTE); if (remainder != 0) blkcount = blkcount + 1; for (var i = 0; i < blkcount; i++) { var reader = new FileReader(); if (i == (blkcount - 1) && remainder != 0) { stop = start + remainder; } if (i == blkcount) { stop = start; } //Slicing the file var blob = file.webkitSlice(start, stop); reader.readAsBinaryString(blob); start = stop; stop = stop + ONEMEGABYTE; } //End of loop } //End of readblob