submitting a jpeg to a web site?

Steven D.Arnold stevena at neosynapse.net
Mon Nov 10 04:51:23 EST 2003


Hi,

I am curious how one might submit a JPEG to a web site using Python.  
I've tried urllib.urlopen, passing a dictionary that contained a key 
pointing to a string that contains the bytes of the JPEG, but that 
didn't apparently work.  I did use the urllib.urlencode function on the 
dict before calling urlopen.  It seems on the face of it that urlopen 
is not the ordained way to do what I want here.

The <form> tag of the page I'm submitting to looks like this:

<form action="application_one_process.php" name="mainForm" 
method="POST" enctype="multipart/form-data" accept-charset="US-ASCII">

The enctype seems to suggest I need some kind of MIME-like capability 
to do this right.  Does anyone know what I should be doing to make this 
work?

Thanks in advance,
steve






More information about the Python-list mailing list