class MultiPartParser: (source)
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 | handle |
Handle all the signaling that takes place when a file is complete. |
Method | parse |
Undocumented |
Method | sanitize |
Sanitize the filename of an upload. |
Class Variable | boundary |
Undocumented |
Method | _close |
Undocumented |
Method | _parse |
Parse the POST data and break it into a FILES MultiValueDict and a POST MultiValueDict. |
Instance Variable | _boundary |
Undocumented |
Instance Variable | _chunk |
Undocumented |
Instance Variable | _content |
Undocumented |
Instance Variable | _encoding |
Undocumented |
Instance Variable | _files |
Undocumented |
Instance Variable | _input |
Undocumented |
Instance Variable | _meta |
Undocumented |
Instance Variable | _post |
Undocumented |
Instance Variable | _upload |
Undocumented |
Initialize the MultiPartParser object. :META: The standard ``META`` dictionary in Django request objects. :input_data: The raw post data, as a file-like object. :upload_handlers: A list of UploadHandler instances that perform operations on the uploaded data. :encoding: The encoding with which to treat the incoming data.
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.