[Flask] Prevent saving of temp file during upload

Dmitry Nikiforov dnikiforov at linkedin.com
Tue Feb 21 14:28:24 EST 2017


Hello All!

I've been looking for a way to prevent Flask/Request/FileStorage from
saving uploaded files on the disk and instead digest them with my own code.

Most (all?) results from Google simply tell to just do file.read(), but
that still results in a file saved in a temp directory and read from the
disk. I'm trying to avoid that, because the uploaded file needs to actually
be passed on to an underlying storage (LI Ambry), and can be hundreds of
gigabytes in size. It's not viable to store the file first and then pass it
on to the final storage service :(

I see that both Request and FileStorage classes can accept a "shallow"
parameter, but there's virtually no information on what it actually does,
or how to use it :(

Any help or suggestions would be greatly appreciated!

-- 
D.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20170221/f4d85102/attachment.html>


More information about the Flask mailing list