I know this question's been posted before but I can't find it at nipltd.com so I post it again. How to find the size of a uploaded file? I've tried: print getattr(REQUEST['file'],'size') and print getattr(REQUEST['file'],'filesize') This works fine though print getattr(REQUEST['file'],'filename') Cheers, Peter
On Monday 16 July 2001 01:19 am, Peter Bengtsson wrote:
I know this question's been posted before but I can't find it at nipltd.com so I post it again.
How to find the size of a uploaded file?
# assuming file pointer is at the beg. of the file f = REQUEST.file f.seek(0,2) size = f.tell() f.seek(0,0) print 'file is this long, %s bytes'%str(size) cheers kapil
On Mon, 16 Jul 2001, Peter Bengtsson wrote:
How to find the size of a uploaded file?
I've tried:
print getattr(REQUEST['file'],'size') and print getattr(REQUEST['file'],'filesize')
I've got a page on my site where I iterate through some files and print their sizes using a simple: <dtml-var expr="get_size()"> -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.org W. St. Paul, MN | | http://slashdot.org wilson@visi.com | <dtml-var pithy_quote> | http://linux.com
Peter Bengtsson wrote:
I know this question's been posted before but I can't find it at nipltd.com so I post it again.
How to find the size of a uploaded file?
I've tried:
print getattr(REQUEST['file'],'size') and print getattr(REQUEST['file'],'filesize')
This works fine though print getattr(REQUEST['file'],'filename')
Cheers, Peter
Should be something like: REQUEST.file.headers['Content-Length'] or REQUEST.file.headers['content-length'] hth, -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
participants (4)
-
Casey Duncan -
ender -
Peter Bengtsson -
Timothy Wilson