[Zope] Get uploaded file size
Dieter Maurer
dieter at handshake.de
Thu Aug 3 13:03:40 EDT 2006
AnThu Nguyen wrote at 2006-8-2 10:13 -0700:
> ...
>I'm trying to get the size of a file uploaded via an HTML form before
>it's written. "context.REQUEST.file" only accesses the file name, not
>the content. How do I read the contents? Any help will be much appreciated.
If "context.REQUEST.file" is the file name and not a
"ZPublisher.HTTPRequest.FileUpload" object, then you
are doing something wrong. Either you use an HTTP "GET" request
or you do not use "multipart/formdata" as mime type.
A "FileUpload" object behaves like a file and you can
use the usual way to determine its size.
--
Dieter
More information about the Zope
mailing list