> I copied the code from manage_addFileFolder so that we can upload files into
> the filesystem but I'd like to amend it so that we can specify the target
> folder rather than just having the file uploaded to the folder in which the
> form resides. 
So how do you want to specify the folder to create File object into?


> How would I do that? I've looked through the code in OFS that handles this
> but am not sure how to add the folder as a variable.... (I;ve tried a couple
> of things unsuccessfully)
You can simply get reference to existing
folder and call _setObject on it like:

a = self.folder1.folder2.folder3
a._setObject(id, File(id,title,'',content_type, precondition))

Or if you want to have web form where you can specify target
folder with path like expressions:
'/folder1/folder2/folder3'

you may want to use:
a = '/folder1/folder2/folder3'
self.restrictedTraverse(a)._setObject...

If you want to create a form with a list of folders
then look at plope.org on Zope Book at API Reference.
There are functions like objectItems:

self.objectItems( 'Folder' )
or
objectItems( 'Foldered (Ordered)' )

-- 
Maciej Wisniowski
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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