[Zope] stupid file upload question

Dieter Maurer dieter@handshake.de
Thu, 14 Dec 2000 21:47:04 +0100 (CET)


Joh Johannsen writes:
 > But it says: "In you python external method you can now reference
 > REQUEST.form['attached_file'] as a normal file. You can
 >                       perform things such as read() on the object. "
 > 
 > Now in my Python external method, I can reference things like:
 > 
 > REQUEST.form['attached_file'].filename
 > 
 > and that is fine.
 > 
 > But what is the syntax for actually reading the file?  From the above
 > quote I thought it was as simple as
 > x=REQUEST.form['attached_file'].read()  but that doesn't work...
Please tell us, how it does not work (in fact, it should work):

   Did you get an attribute error (read) or was the result wrong?

You must use the 'enctype="multipart/form-data"' and
'method=post' form parameter to upload files. Did you do that?


Dieter