File upload in AngularJS causes browser out of memory error
Marshaling the file contents as a byte array is obviously problematic.

Browsers can easily upload files through HTML forms, with

&lt;form method="POST" enctype="multipart/form-data"&gt;
  &lt;input type="file"&gt;
&lt;/form&gt;


Adapt the server to handle file uploads using that mechanism, then develop a replacement AJAX client.