In Flask (Flask-0.10.1 installed via pip) I\'ve tried to handle uploaded files like this
f = flask.request.files[input_name]
stream = f.stream
# then use the
Files smaller than 1024 * 500 bytes are written to a StringIO object, while files greater than that threshold are written to temporary files.
It's part of Werkzeug's testing framework, but that function isn't part of the online documentation:
def stream_encode_multipart(values, use_tempfile=True, threshold=1024 * 500,
boundary=None, charset='utf-8'):
"""Encode a dict of values (either strings or file descriptors or
:class:`FileStorage` objects.) into a multipart encoded string stored
in a file descriptor.
"""
...
Source