Is it possible to change Content-type?

A printers at sendme.cz
Fri Jun 13 16:52:16 EDT 2003


Hi,
 Suppose we have the following form:
 <FORM action="http://server.com/cgi/handle"
       enctype="multipart/form-data"
       method="post">
   <P>
   What is your name? <INPUT type="text" name="submit-name"><BR>
   What files are you sending? <INPUT type="file" 
name="files"><BR>
   <INPUT type="submit" value="Send"> <INPUT type="reset">
 </FORM>
If the user enters "Larry" in the text input, and selects the text file "file1.txt", the user 
agent might send back the following data:
   Content-Type: multipart/form-data; boundary=AaB03x

   --AaB03x
   Content-Disposition: form-data; name="submit-name"

   Larry
   --AaB03x
   Content-Disposition: form-data; name="files"; 
filename="file1.txt"
   Content-Type: text/plain

   ... contents of file1.txt ...
   --AaB03x--


Is it possible to simulate the behaviour of the user agent  and 
use 
Content-type: application/x-www-form-urlencoded
and send the data as 

submit-name=Larry&files"; filename="file1.txt" Content-Type: 
text/plain


That is the data will be in the form of
Name1=Value1&Name2=Value2


Thanks for help
Ladislav








More information about the Python-list mailing list