cgi.parse_multipart()

cgi.parse_multipart(fp, pdict)

Parse input of type multipart/form-data (for file uploads). Arguments are fp for the input file and pdict for a dictionary containing other parameters in the Content-Type header.

Returns a dictionary just like urllib.parse.parse_qs() keys are the field names, each value is a list of values for that field. This is easy to use but not much good if you are expecting megabytes to be uploaded — in that case, use the FieldStorage class instead which is much more flexible.

Note that this does not parse nested multipart parts — use FieldStorage for that.

doc_python
2016-10-07 17:28:22
Comments
Leave a Comment

Please login to continue.