Hi, 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. TIA, AnThu
--On 2. August 2006 10:13:17 -0700 AnThu Nguyen <Anthu.Nguyen@Sun.COM> wrote:
Hi,
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.
Read the data into a string and determine the length of the string. -aj -- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: info@zopyx.com - Phone +49 - 7071 - 793376 E-Publishing, Python, Zope & Plone development, Consulting
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
participants (3)
-
Andreas Jung -
AnThu Nguyen -
Dieter Maurer