[Zope] manage_addFile question
Peter Bengtsson
peter@grenna.net
Mon, 26 Mar 2001 15:16:31 +0100
below
----- Original Message -----
From: "Dimitris Andrakakis" <dandraka_info@yahoo.com>
To: "Zope list" <zope@zope.org>
Sent: Monday, March 26, 2001 2:08 PM
Subject: [Zope] manage_addFile question
> Hi all,
> I'm trying to set up a form to let my users upload
> files in a certain folder. The form is like this:
>
> <form action="fileadd" method="get" enctype="multipart/form-data">
> <input type="file" name="file">
> <input type="submit" name="Submit file">
> </form>
>
> and the "fileadd" dtml method like this:
>
> <dtml-call "PARENTS[0].manage_addFile('testfile.pdf', file)">
>
> This works ok. Two questions:
> 1) I think it's possible to ommit the id, and zope will by default
> use the uploaded file's filename (just the way you upload a file from
> the management screens). But how ? I've tried both manage_addFile('',
file)
> and manage_addFile(file) but they don't work.
> 2) How can I put the file in a subfolder ? Say my form is in /, and I want
> to save the file in /files. I've tried:
>
> <dtml-with files>
> <dtml-call "PARENTS[0].manage_addFile('testfile.pdf', file)">
> </dtml-with>
<dtml-call "nameofsubfolder.manage_addFile('testfile.pdf', file)">
or
<dtml-call "_['nameofsubfolder'].manage_addFile('testfile.pdf', file)">
or
<dtml-call "nameofsubfolder.subsubfolder.manage_addFile('testfile.pdf',
test)">
or
<dtml-call "nameofsubfolder['subsubfolder'].manage_addFile('testfile.pdf',
test)">
To skip the id, use the keyword arguments
manage_addFile(file=file)
or
manage_addFile(title='Title', file=file,
id='orderofkeywordargsdoesntmatter')
Cheers, Peter
>
> but to no avail :-( Anybody ?
>
> Dimitris @ Nuclear
>
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )