4

What is the best way to upload files larger than 1 GB?

Current Situation :: We're using flask to deploy webserver. We have to upload files larger than 1 GB. Previously we only uploaded few mbs of files. So, it wasn't a problem but now with files larger than 1 GB the old method of upload is not possible. The server just timeout.

So is there a good way to upload files?

Andy
  • 49,085
  • 60
  • 166
  • 233
AjanShrestha
  • 545
  • 2
  • 5
  • 12

2 Answers2

1

you need to configure MAX_CONTENT_LENGTH to be at least 1 GB (maybe add more for padding).

from flask import Flask, Request

app = Flask(__name__)
app.config['MAX_CONTENT_LENGTH'] = 1024 * 1024 * 1024
Dani
  • 1,220
  • 7
  • 22
  • that would only solve the file size problem is there a better way to upload files of that size? – AjanShrestha Dec 11 '13 at 16:54
  • I'm not sure I understand, the web is over the HTTP protocol, so whatever method you use is over HTTP. WebDAV allows bi-directional file access, which IMO is overkill since you said you only want users to upload files, not read or edit them, it's no different (speed/reliability wise) than doing a regular PUT or POST request. You could look into FTP, but the consensus on that is other than implied access control, HTTP vs FTP uploads are the same. – Dani Dec 11 '13 at 17:21
0

Using WebDAV (PUT) over HTTP using one of the Python DAV libraries. I personally use TinyDAV library to do this. Not sure on max file size, but I upload > 1GB files using this. It is probably configurable on the DAV server side (mod_dav with Apache).

http://code.google.com/p/tinydav/

http://httpd.apache.org/docs/current/mod/mod_dav.html

http://en.wikipedia.org/wiki/WebDAV

Mark
  • 71
  • 3