Skip to main content

TemporaryUploadedFile

A file uploaded to a temporary location (i.e. stream-to-disk).

Constructor

Signature

def TemporaryUploadedFile(
name: string,
content_type: string,
size: integer,
charset: string,
content_type_extra: dict = None
) - > null

Parameters

NameTypeDescription
namestringThe name of the uploaded file.
content_typestringThe content type of the file (e.g., 'text/plain' or 'image/jpeg').
sizeintegerThe size of the file in bytes.
charsetstringThe character set of the file (e.g., 'utf-8').
content_type_extradict = NoneExtra parameters for the content-type header.

Signature

def TemporaryUploadedFile(
name: string,
content_type: string,
size: integer,
charset: string,
content_type_extra: dict = null
) - > null

Parameters

NameTypeDescription
namestringThe original name of the uploaded file used to determine the temporary file extension
content_typestringThe MIME type of the uploaded file, such as 'image/jpeg'
sizeintegerThe size of the uploaded file in bytes
charsetstringThe character set of the file content if applicable
content_type_extradict = nullAdditional parameters for the content-type header

Methods


temporary_file_path()

@classmethod
def temporary_file_path() - > string

Return the full path of this file.

Returns

TypeDescription
stringThe absolute file system path to the underlying temporary file on disk

close()

@classmethod
def close() - > null

Closes the underlying temporary file and handles cases where the file may have already been moved or deleted from the file system.

Returns

TypeDescription
nullNone