Problems with CGI, genCGI and a multipart form
webmaster at epls.com
webmaster at epls.com
Mon Jun 21 03:45:31 EDT 1999
On Jun 17, 1999, peter_carl at my-deja.com wrote:
>I'm having trouble getting cgi.FieldStorage to read data posted as
>multipart/form-data.
>Right now I am testing a script using stdin piped from a test file. The
>test file has everything after the header from a posted form, e.g.,:
>
> -----------------------------172981055621895
> Content-Disposition: form-data; name="section"
>
> production
> -----------------------------172981055621895
> Content-Disposition: form-data; name="title"
>
> This is the title
>
>etc...
>
>Environment variables for Content-type, Content-Length, and
>REQUEST_METHOD (POST) are set correctly.
1. Did you end the multipart data with an additional "--" to your last boundary:
-----------------------------172981055621895--
This is required to end the data portion correctly.
2. BTW, is there any reason you test your cgi script with a file via stdin
(plus somehow set your environment vars)? Isn't it simpler to just set up
a httpd on your development host to test your scripts? Preparing the http headers
and data file manually for testing is, in our opinion, error-prone.
3. We have used multipart POST cgi (with cgi.py) without problem in our
application. We always test directly with a httpd.
yours-common-gateway-ly
alan kang
http://www.epls.com - free groupware online
More information about the Python-list
mailing list