0

I'm building a web application using Flask on a backend and ReactJS on a frontend. I need to be able to upload large (like tens or more than 100 of GB) high resolution video files.

For small videos, it's pretty easy. I'm using standard upload form and fetch API, sending POSTs with movie data in payload of my request.

The problem begins when my video becomes larger. I can easily upload a file of a size of 4GB but when it's about 8GB (amount of RAM memory in my workstation-if that matters) my browser freezes for some time and finally not whole file is being POSTed.

While uploading a file of a size about 30GB my Flask server throws a MemoryError.

Is there any nice way to upload such large files through the websites upload form? Maybe some kind of upstreaming to server or splitting file to parts?

Ahmet Emre Kilinc
  • 5,489
  • 12
  • 30
  • 42
SP5RFD
  • 841
  • 3
  • 17
  • 31
  • 3
    Usually we don’t upload large file(bigger than 100M) through website at all. If you really want to do that, try forking an isolated async task to avoid blocking the whole Flask application. – Light.G Oct 11 '18 at 14:29
  • So how do they do it on Youtube or another video streaming websites? – SP5RFD Oct 12 '18 at 06:09
  • On a popular video streaming websites they write their own custom high-performance upload implementation, they don't use basic Flask's upload. If you don't want to write your own implementation of a such upload, take a look at [Nginx upload](https://www.nginx.com/resources/wiki/modules/upload/). Also, chunked approach [from here](https://stackoverflow.com/questions/15040706/streaming-file-upload-using-bottle-or-flask-or-similar) is a good idea. – Fine Oct 12 '18 at 10:16

0 Answers0