using urllib or httplib to post with ENCTYPE=mulitpart/form-data

Kevin Carlson khcarlso at bellsouth.net
Wed Jun 4 16:28:20 EDT 2003


Hi,

I am trying to post to a form using httplib or urllib.  I have done this 
successfully before with httplib, but when the enctype must be 
multipart/form-data, things go awry.

I tried using a header {'Content-Type' : 'multipart/form-data', ...} 
that I encode with urlencode and then pass to the HTTPConnection.request 
method, but the server is returning a code indicating a bad request.  I 
have done a lot of troubleshooting on this and the encoding type is the 
only remaining issue.

Can anyone shed some light on how to accomplish a POST of this type?

Thanks,

Kevin






More information about the Python-list mailing list