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
| Name | Type | Description |
|---|---|---|
| name | string | The name of the uploaded file. |
| content_type | string | The content type of the file (e.g., 'text/plain' or 'image/jpeg'). |
| size | integer | The size of the file in bytes. |
| charset | string | The character set of the file (e.g., 'utf-8'). |
| content_type_extra | dict = None | Extra 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
| Name | Type | Description |
|---|---|---|
| name | string | The original name of the uploaded file used to determine the temporary file extension |
| content_type | string | The MIME type of the uploaded file, such as 'image/jpeg' |
| size | integer | The size of the uploaded file in bytes |
| charset | string | The character set of the file content if applicable |
| content_type_extra | dict = null | Additional parameters for the content-type header |
Methods
temporary_file_path()
@classmethod
def temporary_file_path() - > string
Return the full path of this file.
Returns
| Type | Description |
|---|---|
string | The 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
| Type | Description |
|---|---|
null | None |