UploadedFile - wrvenkat/request_parser GitHub Wiki
Usage
An UploadedFile class represents a file that was part of a multipart/form-data request. Such a file may be in-memory - InMemoryUploadedFile; or on-disk - TemporaryUploadedFile. However, this information is usually opaque to the API users.
An UploadedFile is a sub-class of File and hence exposes the same API as that of File.
It also exposes the following attributes,
name |
name of the file as specified in the name parameter in the multipart header |
size |
size of the file in bytes |
content_type |
content type of the uploaded file |
charset |
encoding set in the multipart header |
transfer_encoding |
transfer_encoding if any, set in the multipart header |
content_type_extra |
any additional parameters provided for the Content-Type header in the multipart header |
For temporary files, i.e TemporaryUploadedFile objects, calling close() deletes the file from the disk. So, it is suggested to call close only when it is certain that the file is no longer required.