CGI File Size Limit?

Ed elb at
Tue May 2 10:03:15 EDT 2000

Thanks a lot.  I looked inside and found:

class FieldStorage( self, fp=None, .... )


self.fp = fp or sys.stdin

So all I have to do, I think, is create a file object that reads standard input,
with mode binary, and pass it to FieldStorage when I create my cgi.FieldStorage

I'm sure I'll feel stupid later, but I have to ask, how do I do this?
Would it be something like: "binary_stdin = open( sys.stdin, 'rb')" ?


"Andrew M. Kuchling" wrote:

> Ed <elb at> writes:
> > More information:
> > If I test the len(form["userfile"].value), it is only 3134 instead of
> > 18k (the "CONTENT_LENGTH").  That means the module is not getting
> > the data.  Something wrong with CGI module reading binary data off of
> > the standard input stream.
> Given that you seem to be using Windows, you'd have to open stdin in
> binary mode; it's probably hitting a Ctrl-Z and ending early.  I don't
> remember the incantation for doing this; someone else will doubtless
> remember it.
> --
> A.M. Kuchling         
> Destiny smells of dust and the libraries of night. He leaves no footprints. He
> casts no shadow.
>   -- From SANDMAN: "Season of Mists", episode 0

More information about the Python-list mailing list