[Zope] Re: [Zope-dev] Inserting file in ZODB

Danny William Adair danny@adair.net
Wed, 28 Nov 2001 21:55:48 +1300


Hello Demont!

a) If I understand you correctly, you want to upload a file from the client's 
file system to the server's ZODB as a new "file" object. Use:

<dtml-call "folderobjectofyourchoice.manage_addFile('id_of_your_choice', 
file)">

(Make sure you had
enctype="multipart/form-data"
set in your form tag)

This call will set the new file object's title to the filename by default. 
You have said that you want to set the _title_, but didn't mention the new 
object's id. If you specify keyword arguments, you can set everything by hand:

<dtml-call "folderofyourchoice.manage_addFile(title='title of your choice', 
file=file, id='the_order_of_keyword_arguments_is_irrelevant')">

b) Please do not post on both "zope@zope.org" AND "zope-dev@zope.org" (see 
generated footer in mail)

c) zope-dev is meant to be a mailing list for the development OF Zope, not 
WITH Zope. zope@zope.org would have been the appropriate place for posting. 
See http://www.zope.org/Resources/MailingLists

d) Your question was definitely a FAQ. The Mailing List Archives are a very 
good place to start looking for an answer. Actually, I got more answers from 
there than from anyone personally! You can search them at NIP: 
http://zope.nipltd.com/public/lists.html

Hope this helps,
Danny


On Wednesday 28 November 2001 21:29, Demont Maarten wrote:
> Hey
>
> I want to insert a file from my "normal" file system into the ZODB
> database.  I have collected the path from a form-field "file".
> The file that needs inserting must be placed in a certain folder inside
> Zope, and gets a title that I base upon a certain number.
>
> How can I - using DTML - insert this file?
>
> Can anyone supply me (fast, this is quite urgent...) with a few lines of
> code explaining this?
>
>
> Thanx!!!!!
>
>
> Maarten Demont
> maarten.demont@cronos.be
> Zope-Newbie

----------------------------------------
Content-Type: text/html; charset="iso-8859-1"; name="Attachment: 1"
Content-Transfer-Encoding: quoted-printable
Content-Description: 
----------------------------------------