class MultiPartParser:
A rfc2388 multipart/form-data parser.
MultiValueDict.parse() reads the input stream in chunk_size chunks and returns a tuple of (MultiValueDict(POST), MultiValueDict(FILES)).
Method | __init__ |
Initialize the MultiPartParser object. |
Method | _close_files |
Undocumented |
Method | handle_file_complete |
Handle all the signaling that takes place when a file is complete. |
Method | parse |
Parse the POST data and break it into a FILES MultiValueDict and a POST MultiValueDict. |
Method | sanitize_file_name |
Sanitize the filename of an upload. |
Instance Variable | _boundary |
Undocumented |
Instance Variable | _chunk_size |
Undocumented |
Instance Variable | _content_length |
Undocumented |
Instance Variable | _encoding |
Undocumented |
Instance Variable | _files |
Undocumented |
Instance Variable | _input_data |
Undocumented |
Instance Variable | _meta |
Undocumented |
Instance Variable | _post |
Undocumented |
Instance Variable | _upload_handlers |
Undocumented |
Unknown Field: meta | |
The standard META dictionary in Django request objects. | |
Unknown Field: input_data | |
The raw post data, as a file-like object. | |
Unknown Field: upload_handlers | |
A list of UploadHandler instances that perform operations on the uploaded data. | |
Unknown Field: encoding | |
The encoding with which to treat the incoming data. |
Parse the POST data and break it into a FILES MultiValueDict and a POST MultiValueDict.
Return a tuple containing the POST and FILES dictionary, respectively.
Sanitize the filename of an upload.
Remove all possible path separators, even though that might remove more than actually required by the target system. Filenames that could potentially cause problems (current/parent dir) are also discarded.
It should be noted that this function could still return a "filepath" like "C:some_file.txt" which is handled later on by the storage layer. So while this function does sanitize filenames to some extent, the resulting filename should still be considered as untrusted user input.