class FileStorage:
FileStorage
class is a thin wrapper over incoming files.
It is used by the request object to represent uploaded files. All the
attributes of the wrapper stream are proxied by the file storage so
it's possible to do storage.read() instead of the long form
storage.stream.read().Method | __bool__ |
Undocumented |
Method | __getattr__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __iter__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | close |
Close the underlying file if possible. |
Method | save |
No summary |
Instance Variable | filename |
Undocumented |
Instance Variable | headers |
Undocumented |
Instance Variable | name |
Undocumented |
Instance Variable | stream |
Undocumented |
Property | content_length |
The content-length sent in the header. Usually not available |
Property | content_type |
The content-type sent in the header. Usually not available |
Property | mimetype |
No summary |
Property | mimetype_params |
The mimetype parameters as dict. For example if the content type is text/html; charset=utf-8 the params would be {'charset': 'utf-8'}. |
Method | _parse_content_type |
Undocumented |
Instance Variable | _parsed_content_type |
Undocumented |
Undocumented
Save the file to a destination path or file object. If the destination is a file object you have to close it yourself after the call. The buffer size is the number of bytes held in memory during the copy process. It defaults to 16KB.
For secure file saving also have a look at secure_filename
.
pathlib
.Parameters | |
dst | a filename, os.PathLike , or open file
object to write to. |
buffer_size | Passed as the length parameter of
shutil.copyfileobj . |
Like content_type
, but without parameters (eg, without
charset, type etc.) and always lowercase. For example if the content
type is text/HTML; charset=utf-8 the mimetype would be
'text/html'.