1

Uploading a file to a rest service like this:

<input type="file" style="display:none" id="eeeee" onchange="
   var f = files[0];
   var r = new FileReader();
   r.onload=function(e){
  var dat = new Int8Array(e.target.result);
  var x=new XMLHttpRequest();
  x.open('POST','rest/database/22/backup/');
  x.send(dat);
   };
   r.readAsArrayBuffer(f);
 "/>
 <button onclick="document.getElementById('eeeee').click();">Upload</button>

results in a:

enter image description here

Any idea how to avoid this problem?

EDIT

I could reproduce the problem in the question. Press Run code snippet and upload a huge file (no sensitive files please, we never know who listen our network-traffic).

Grim
  • 1,938
  • 10
  • 56
  • 123
  • Check your webserver configuration, it may have a maximum upload limit. – Barmar Mar 17 '19 at 09:12
  • PHP has an `upload_max_size` setting, see https://stackoverflow.com/questions/2184513/change-the-maximum-upload-file-size – Barmar Mar 17 '19 at 09:13
  • @Barmar Webserver does not have a maximum upload limit. Non-ajax uploads > 200mb work. Also, if the server refuse the upload it should not be a `oh-no` message in the client but a server-side 5xx status-code. – Grim Mar 17 '19 at 09:15

2 Answers2

0

I would consider uploading files in small chunks maybe using FileReader.onprogress

fruit11
  • 16
  • 1
  • Its a chrome problem only. Id like to KISS (Keep it stupid simple). A form might be better but I dont know how to form-post without form-fields. – Grim Mar 18 '19 at 07:18
0

Was a bug in chrome. Current version does work.

Grim
  • 1,938
  • 10
  • 56
  • 123