title: Server fails to upload large files with gunicorn
body: <p>I made a small server with flask to upload files (and then do stuff with them). The upload is through and HTML form that sends a file:</p>
  
  <pre><code>&lt;form action="/upload" method="POST" enctype="multipart/form-data"&gt;
      &lt;input type="file" name="file"&gt;
      &lt;input type="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>On the server side I do the following:</p>
  
  <pre><code>@app.route('/upload', methods=['POST'])
  def upload():
      if 'file' in request.files:
          f = request.files['file']
          file_path = os.path.join(app.config['UPLOAD_FOLDER'], werkzeug.secure_filename(f.filename))
          f.save(file_path)
  
      return 'File is being uploaded'
  </code></pre>
  
  <p>It works fine for small files but on large files, it fails. The problem is that if I run the script manually not through gunicorn <code>python main.py</code> I can upload files that I couldn't before. I thought I needed to change the max size in gunicorn but couldn't find how to do it.</p>
  
  <p>I also thought to use a stream and then write chunks but again, I couldn't find how to access the stream with flask.</p>
  
  <p>Thanks for your help</p>