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

Jens Vagelpohl jens@zope.com
Wed, 28 Nov 2001 07:43:50 -0500


demont,

please do not cross-post your messages to more than one mailing list and=20=

please do not send HTML-formatted mail to the list.

if the file that you want to get is supposed to be read from the=20
filesystem of the machine your zope is running on without being uploaded=20=

by someone using a "file" form field then you cannot do this directly in=20=

DTML. Zope cannot touch the file system on the machine it runs on in=20
arbitrary locations, think about the security risk.

what you would need to do is write an external method and pass it the =
file=20
path. external methods have less security restrictions and you could =
read=20
the file that way and instantiate an object in the ZODB from it.

jens




On Wednesday, November 28, 2001, at 03:29 , Demont Maarten wrote:

> Hey
>
> =A0
>
> I want to insert a file from my =93normal=94 file system into the ZODB=20=

> database.=A0I have collected the path from a form-field =93file=94.=A0
>
> The file that needs inserting must be placed in a certain folder =
inside=20
> Zope, and gets a title that I base upon a certain number.
>
> =A0
>
> How can I =96 using DTML =96 insert this file?
>
> =A0
>
> Can anyone supply me (fast, this is quite urgent=85) with a few lines =
of=20
> code explaining this?
>
> =A0
>
> =A0
>
> Thanx!!!!!
>
> =A0
>
> =A0
>
> Maarten Demont
>
> maarten.demont@cronos.be
>
> Zope-Newbie
>