[Zope] file upload formular

Dieter Maurer dieter@handshake.de
Wed, 12 Jun 2002 20:40:10 +0200


Simon Brun writes:
 > For our intranet I'm going to improve the file upload. In the past, the
 > workers had to upload their files via the ZMI. They had to add some properties
 > (like author, keyword, etc.). Afterwards some dtml-methods listed the content of
 > the directories by mapping the properties of the documents. 
 > 
 > I now want to create a html-form which help the people to upload their files. In
 > this form they have to insert the properties and after pressing the submit
 > button, the file should be uploaded into Zope.
 > 
 > I'm sure this was done by other users before, but I didn't find something. Any
 > good ideas or code out there?
You need two things:

    a form and an action; optionally, a result page

You can start with the form "fileAdd.dtml" (search your computer for it).
Extend it as necessary.

In the action, you create (and upload) the file object ("manage_addFile")
Then, you define the new properties you would like to have ("manage_addProperty").
Finally, you give them the correct values from the form with
"manage_changeProperties".

The necessary documentation is in the embedded Online help:

    Zope Help -> API Reference -> File
                                  PropertyManager

Search the archives and Zope.org for the relevant methods to
find examples and more information.


Dieter