i am trying to use XMLHttpRequest to upload file(image) to my server side, well, i check the file size before sending and check the content-length on my request header, they are not the same, here is the code :
var file = 'someFile'; 
var readers = new FileReader();
readers.readAsBinaryString(file);
readers.onload = (function(theFile) {
  return function(e) {                     
       var myData =  e.target.result;
       console.log(myData.length); // this output is 5548
       var xhr = new XMLHttpRequest();
       xhr.open("POST", url, true);
       xhr.setRequestHeader('Content-Type', 'application/octet-stream;');
       // send the collected data as JSON
       xhr.send(myData );
       xhr.onloadend = function () {
          // done               
       };
  })(file);
when i am looking at the content-lenght on my header request i found the length is bigger than the actaul size , some number like ~7500,
how i can make sure the request file data is the same as the actual size of the file?
 
    