Is it possible to change Content-type?
John J. Lee
jjl at pobox.com
Sat Jun 14 11:06:26 EDT 2003
More information about the Python-list mailing list
Sat Jun 14 11:06:26 EDT 2003
- Previous message (by thread): OT: swearing (was: RE: OnFileOpent(self, event))
- Next message (by thread): Is it possible to change Content-type?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"A" <printers at sendme.cz> writes: > Suppose we have the following form: > <FORM action="http://server.com/cgi/handle" > enctype="multipart/form-data" > method="post"> [...] > </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 [...] > Is it possible to simulate the behaviour of the user agent and > use Have you actually checked to see what your user agent (aka web browser, I assume) sends? > Content-type: application/x-www-form-urlencoded > > and send the data as > > submit-name=Larry&files"; filename="file1.txt" Content-Type: > text/plain Neither RFC 1867 (see also RFC 1866) and HTML 4.01 say you *have* to do file upload using multipart/form-data, but the server might not like it if you use application/x-www-form-urlencoded. In fact, I think if you go by the letter of HTML 4.01, you'd send back 'files=' for your file control (or possibly nothing at all) if you're using x-www-form-urlencoded, which isn't very much use. 'files=Larry' might possibly work, but I don't see why you'd want to try, really. In other words, don't do that. RFC 2388 is also relevant to multipart/form-data. The 0.1.2a version of the following might help you (ATM, I've only tested the file upload code against the cgi module, and it only does single-file upload -- and IIRC it would just send 'files=' if you explicitly asked for form.enctype = "application/x-www-form-urlencoded"). http://wwwsearch.sourceforge.net/ClientForm/ John
- Previous message (by thread): OT: swearing (was: RE: OnFileOpent(self, event))
- Next message (by thread): Is it possible to change Content-type?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list