This is my first application in HTML5. Application read local file, splits it into chunks and send to server, this works perfectly.
Part of program:
var reader = new FileReader();
// Read data from chunk
reader.onloadend = function(evt) {
if (evt.target.readyState == FileReader.DONE) { // DONE == 2
blob_content = evt.target.result; // This problem, chunk != blob_content
}
};
chunk = blob.slice (start, end);
reader.readAsBinaryString(chunk);
// readAsBinaryString same
xhr.open ("post", "upload.php", false);
xhr.send (blob_content); // This send data about 30% larger
// xhr.send (chunk); // This send data correctly
I need to work with data in a chunk (e.g. encrypt) and do not know how. My fictional function generates data about 30% larger.
Maybe problem with mime type?
Thanks.
Sorry for my excellent English.
readAsBinaryStringat all? For encryption (which should be done by the connection btw) or any other manipulation, you most likely would want to usereadAsArrayBuffer.xhr.sendin theonloadendcallback; I don't know how elsewise anything could be sent.