Upload of binary files

Max M maxm at mxm.dk
Fri Mar 14 07:14:49 EST 2003


Irmen de Jong wrote:

> I *may* indeed be wrong here, but consider this:
> I was thinking.. "from your CGI code you're actually reading from
> a socket, that's wrapped in a file-like object".
> Sockets behave like I said. So I thought: the read() behaves like this too.
> Even more so because there is no such thing as "EOF" on sockets.
> How can the read() know when all data have been read?


The cgi module returns a FieldStorage object.

If you have uploaded a file, cgi will take care of the actual uploading, 
and save the uplodad file in a file-like object.

This file is what you get from the FieldStorage object.

So ... you simply worry to much ;-) It's easier than you think.

-- 

hilsen/regards Max M Rasmussen, Denmark

http://www.futureport.dk/
Fremtiden, videnskab, skeptiscisme og transhumanisme





More information about the Python-list mailing list