class documentation

class FileStorage:

View In Hierarchy

The 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
def __bool__(self):

Undocumented

def __getattr__(self, name):

Undocumented

def __init__(self, stream=None, filename=None, name=None, content_type=None, content_length=None, headers=None):

Undocumented

def __iter__(self):

Undocumented

def __repr__(self):

Undocumented

def close(self):
Close the underlying file if possible.
def save(self, dst, buffer_size=16384):

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.

Changed in version 1.0: Supports pathlib.
Parameters
dsta filename, os.PathLike, or open file object to write to.
buffer​_sizePassed as the length parameter of shutil.copyfileobj.
filename =

Undocumented

headers =

Undocumented

name =

Undocumented

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 =

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'.

New in version 0.7.
@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'}.

New in version 0.7.
def _parse_content_type(self):

Undocumented

_parsed_content_type =

Undocumented