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. 

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)


manage_addFileForm=HTMLFile('dtml/imageAdd',
globals(),Kind='File',kind='file')
def manage_addFile(self,id,file='',title='',precondition='',
content_type='',
                   REQUEST=None):
    """Add a new File object.

    Creates a new File object 'id' with the contents of 'file'"""

    id=str(id)
    title=str(title)
    content_type=str(content_type)
    precondition=str(precondition)

    id, title = cookId(id, title, file)

    self=self.this()

    # First, we create the file without data:
    self._setObject(id, File(id,title,'',content_type, precondition))

    # Now we "upload" the data.  By doing this in two steps, we
    # can use a database trick to make the upload more efficient.
    self._getOb(id).manage_upload(file)
    if content_type:
        self._getOb(id).content_type=content_type

    if REQUEST is not None:
        REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')

Katie



_______________________________________________
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