Skip to main content

UploadedFile

An abstract uploaded file (TemporaryUploadedFile and InMemoryUploadedFile are the built-in concrete subclasses).

An ``UploadedFile`` object behaves somewhat like a file object and
represents some file data that the user submitted with a form.

Attributes

AttributeTypeDescription
namestringThe sanitized name of the uploaded file, restricted to the basename and a maximum length of 255 characters to ensure safe storage across different operating systems.

Constructor

Signature

def UploadedFile(
file: file-like object = None,
name: str = None,
content_type: str = None,
size: int = None,
charset: str = None,
content_type_extra: dict = None
) - > null

Parameters

NameTypeDescription
filefile-like object = NoneThe underlying file-like object.
namestr = NoneThe name of the uploaded file.
content_typestr = NoneThe MIME type of the file (e.g., image/jpeg).
sizeint = NoneThe size of the file in bytes.
charsetstr = NoneThe character set of the file (e.g., utf-8).
content_type_extradict = NoneExtra parameters for the content-type header.