class documentation

class FileStorage: (source)

View In Hierarchy

The :class:`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 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...
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 Like :attr:`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'``.
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): (source)

Undocumented

def __getattr__(self, name): (source)

Undocumented

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

Undocumented

def __iter__(self): (source)

Undocumented

def __repr__(self): (source)

Undocumented

def close(self): (source)

Close the underlying file if possible.

def save(self, dst, buffer_size=16384): (source)

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 :func:`secure_filename`. :param dst: a filename, :class:`os.PathLike`, or open file object to write to. :param buffer_size: Passed as the ``length`` parameter of :func:`shutil.copyfileobj`. .. versionchanged:: 1.0 Supports :mod:`pathlib`.

filename = (source)

Undocumented

Undocumented

Undocumented

Undocumented

@property
content_length = (source)

The content-length sent in the header. Usually not available

@property
content_type = (source)

The content-type sent in the header. Usually not available

Like :attr:`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'``. .. versionadded:: 0.7

@property
mimetype_params = (source)

The mimetype parameters as dict. For example if the content type is ``text/html; charset=utf-8`` the params would be ``{'charset': 'utf-8'}``. .. versionadded:: 0.7

def _parse_content_type(self): (source)

Undocumented

_parsed_content_type = (source)

Undocumented