File Uploads

Doug Helm dhelm at wcsoftware.com
Mon Mar 28 21:19:40 EST 2005


Andrew:

I'm a dope.  You're brilliant.  Thank you.  That worked splendidly.

Doug

<and-google at doxdesk.com> wrote in message
news:1111988579.390466.68750 at g14g2000cwa.googlegroups.com...
> Doug Helm wrote:
>
> > form = cgi.FieldStorage()
> >   if lobjUp.Save('filename', 'SomeFile.jpg'):
>
> > class BLOB(staticobject.StaticObject):
> >   def Save(self, pstrFormFieldName, pstrFilePathAndName):
> >     form = cgi.FieldStorage()
>
> You are instantiating cgi.FieldStorage twice. This won't work for POST
> requests, because instantiating a FieldStorage reads the form data from
> the standard input stream (the HTTP request).
>
> Try to create a second one and cgi will try to read all the form data
> again; this will hang, waiting for the socket to send it a load more
> data which will not be forthcoming.
>
> When using CGI, parse the input only once, then pass the results (a
> FieldStorage object if you are using the cgi module) in to any other
> functions that need to read it.
>
> --
> Andrew Clover
> mailto:and at doxdesk.com
> http://www.doxdesk.com/
>





More information about the Python-list mailing list