title: AngularJS: PUT binary data from ArrayBuffer to the server
body: <p>Ok, so I try to read a PDF file like this: </p>
  
  <pre><code>reader.readAsArrayBuffer(file);
  </code></pre>
  
  <p>and then try to send it to the server using <code>$http</code> like this:</p>
  
  <pre><code>$http.put(url, data, {headers: {'Content-Type': 'application/pdf'}});
  </code></pre>
  
  <p>So, just read &amp; send the binary to the server in raw form. According to some resources I found, passing an ArrayBuffer to <code>XHR</code> <em>should</em> work, but passing it as data to <code>$http</code> just results in a request <code>body</code> like this: <code>{}</code> and <code>Content-Length=2</code></p>
  
  <p>Reading the file <code>readAsBinaryString()</code> results in a corrupted file (and is apparently deprecated for that very reason)</p>
  
  <p>The use case seems so trivial to me, am I missing something?</p>
  
  <p>Chrome 36, Angular 1.2.20</p>