Am Dienstag, den 25.10.2005, 14:43 -0400 schrieb Jonathan Cyr:
> Hello,
> Does a FileUpload object have a get_size() method?
> I'd like to limit the size of an uploaded file before commiting it to 
> the ZODB.  I've been Googling for a while.  Is it handled differently on 
> a FileUpload object.
> I'm planning to process with a Python Script.
> Could someone point me in the right direction?

The fileupload object is simply a file. (can be cStringIO, 
can be tempfile - depending on size)

Best is to do so:

maxsize=1<<20 # 1MB


    raise OverflowError("File too big!") # or something like that # rewind to start


This avoids loading the whole file into memory to find out.


Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to