File Uploads

Doug Helm dhelm at
Tue Mar 29 04:19:40 CEST 2005


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


<and-google at> wrote in message
news:1111988579.390466.68750 at
> 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

More information about the Python-list mailing list