Uploading a file via POST ?
Oliver Hofmann
a2619725 at uni-koeln.de
Tue Mar 27 11:03:59 EST 2001
'lo everyone!
I am trying to write a small client in Python which submits a file
to a webpage via the POST method. Part of the .html reads:
----
<FORM METHOD=POST ENCTYPE=multipart/form-data
ACTION="/cgi-bin/tst.pl_batch"
onsubmit="return FSubmitValidation(this)">
<INPUT TYPE=text SIZE=40 NAME=Email_Address>
<INPUT TYPE=file NAME=UpLoad_File SIZE=50>
----
I've taken a look at urllib.urlopen, however it seems to be limited
more or less to GET requests. An optional data-argument must be
in 'standard application/x-www-form-urlencoded format'; since the
form requires multipart form-data this is probably not going to
work.
Is there an easy way to upload a file and pass parameters to the
server script?
Thanks a lot,
Oliver
More information about the Python-list
mailing list