Re: Uploading images via cgi?
- From: "Paul Boddie" <paul@xxxxxxxxxxxxx>
- Date: 31 Aug 2005 07:34:39 -0700
Chris Dewin wrote:
> chunk = fileitem.file.read(100000), and fout.write (chunk) seem to be the
> key statements. Could someone elaborate on these for me please? And why
> do they need to be in a while loop?
I imagine that the intention of reading only 100000 bytes at a time is
to limit the amount of memory used by the process. In an environment
where the process is kept around (not CGI, however) doing so might be
critical since it has been alleged that Python isn't particularly good
at freeing memory back to the operating system.
One way of limiting the total size of uploaded files might be to
examine the "Content-Length" header and to reject (ie. not process)
uploads involving files above a certain size.
Paul
.
- References:
- Uploading images via cgi?
- From: Chris Dewin
- Re: Uploading images via cgi?
- From: Peter Hansen
- Re: Uploading images via cgi?
- From: Chris Dewin
- Uploading images via cgi?
- Prev by Date: Re: Bicycle Repair Man usability
- Next by Date: using python_ldap for authentication
- Previous by thread: Re: Uploading images via cgi?
- Next by thread: Adding bound methods dynamically...
- Index(es):