5

Is there a way to read the raw file content of the file and send the binary data to the server with an XMLHttpRequest ajax request? In HTML5 browsers I can do this:

reader = new FileReader();
reader.readAsArrayBuffer(file);
reader.onload = function(e) {
   xhr.send(e.target.result);
} 

There are some libraries like FileAPI or FileReader polyfill but none of them support readAsArrayBuffer() and if I use readAsBinaryString() the binary data will be screwed up while converting to String, and extra characters will be added to the content.

Any suggestions?

danial
  • 4,058
  • 2
  • 32
  • 39

0 Answers0