Problems with CGI, genCGI and a multipart form

webmaster at webmaster at
Mon Jun 21 03:45:31 EDT 1999

On Jun 17, 1999, peter_carl at wrote:

>I'm having trouble getting cgi.FieldStorage to read data posted as

>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
>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:

   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 without problem in our 
   application. We always test directly with a httpd.


alan kang - free groupware online

More information about the Python-list mailing list