1

What is the best way to upload a large file (image) using the FileReader API?

I currently use:

var reader = new FileReader()
reader.readAsDataURL(file)

To upload images to the server in NodeJS. However this only works up to 10 MB. Whenever the image is larger than 10 MB, it always crashes, and even if it succeeds, the browser is incredibly sluggish until refreshed. I'm guessing that's happening because the large file is stored in the browser memory.

Is there a better way to handle a large file upload?

Mcope
  • 781
  • 8
  • 22
  • Might be related to: [Using Javascript FileReader with huge files](http://stackoverflow.com/questions/17472313/using-javascript-filereader-with-huge-files) – t.niese Dec 16 '14 at 21:52
  • 1
    Why not use the FormData API with XHR to upload the file? – mscdex Dec 16 '14 at 22:03

0 Answers0