Python - Getting file size of file object from file upload in Flask
In case of an upload field like <input type="file" name="foo"/>
in the HTML page, request.files['foo']
gives you an object, which has an integer attribute called content_length
. This is the size of the uploaded file in bytes, see example usage here: https://github.com/dnet/photochecklist/blob/5072331/model.py#L78