----- Original Message ----- From: "Mihamina Rakotomandimby" <[EMAIL PROTECTED]>
To: <Zope@zope.org>
Sent: Monday, December 18, 2006 10:10 AM
Subject: Re: [Zope] add a File type via a form

On Mon, 2006-12-18 at 08:42 -0500, Jonathan wrote:

If you are trying to get your 'visitor' to upload a file (?),

No. I want the visitor to fill a form, and then the values he filled the
form with are stored un 1 File.
1 File per form filled.

If you are not trying to upload a file, then we need some more information
as to what you are trying to accomplish.

So, each time a visitor fills a form, I firts need to create the File,
then I will see later how to write into the File.
But I almost found: I have to use manage_addfile.
But I dont know, the "title" argument is not working properly:
If I hardcode the "title" when calling manage_addfile, there is no
If I try to set it throuhg the form, the string goes into the body of
the file instead of the "title" when the File is created...

If you have a simple html form like:

<form action="ptst" method="post">
Enter File Name:     <input type="text" name="fName" value="" size="20"><br>
Enter File Title: <input type="text" name="fTitle" value="" size="20"><br> Enter File Type: <input type="text" name="fType" value="" size="20"><br><br>
<input type="submit" value="Create File">

And a simple python script ('ptst') with parameters "fName", "fType" and "fTitle" (note: script parameters match form field names) and contains something like:

context.manage_addFile(id=fName, file=None, content_type=fType, title=fTitle)
return 'Done'

It should give you the basis for what you are trying to accomplish (if I understand the requirement correctly!)

Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to