[Zope] upload file and edit it in place?

Dieter Maurer dieter@handshake.de
Tue, 4 Sep 2001 00:39:51 +0200 (CEST)


Milos Prudek writes:
 > <form action="&dtml-URL0;" method="post" enctype="multipart/form-data">
 >   <textarea name="file" cols="50" rows="8">
 >     <dtml-if file>
 >       <dtml-var file>
 >     </dtml-if>
 >   </textarea><br>
 >   <input type="file" name="file" size="25" value=""><br>
 >   <input type="submit" name="submit" size="25" value="Go!">
 > </form>
 > 
 > But it does not work as desired. Although I use
 > enctype="multipart/form-data", it still displays   "['      ',
 > <ZPublisher.HTTPRequest.FileUpload instance at 873b710>]" within
 > textarea.
 > 
 > How can I make it display the contents of uploaded data?
FileUpload instances behave like Python files.

You call the "read" method to get the content:

    <dtml-var "file.read()">

You might get an "Unauthorized". In this case, you would
need to patch "ZPublisher.HTTPRequest.FileUpload" to
get an "__allow_access_to_unprotected_subobjects__=1".


Dieter