All: I need to make a file uploader which can upload to a specific folder(selected by the user in the form) and set permissions. Can anybody help I''m having major problems! Thanks, Todd
Hi Todd, Do you want to store your files on the local file system or in Zope as File objects? Either way, have a look at how the 'Add File' form works in Zope. That'll show you how to get the file up to Zope. From there you will need to move it to the folder you want. I upload to a LocalFS object ('data'). Here's the form used to collect the file name: --------------------------------- <dtml-var standard_html_header> <H2><dtml-var document_title></H2> Select the file you want to upload from your local drive by clicking the "Browse" button.<br> Then, click the "Upload" button.<br> <FORM ACTION="AddFile" METHOD="POST" ENCTYPE="multipart/form-data"> <TABLE CELLSPACING="2"> <TR> <TD ALIGN="LEFT" VALIGN="TOP"> <STRONG>File Name</STRONG> </TD> <TD ALIGN="LEFT" VALIGN="TOP"> <input type="text" name="FileName" size="40"> </TD> </TR> <TR> <TD ALIGN="LEFT" VALIGN="TOP"> <STRONG>File</STRONG> </TD> <TD ALIGN="LEFT" VALIGN="TOP"> <INPUT TYPE="file" NAME="file" SIZE="25" VALUE=""> </TD> </TR> <TR> <TD></TD> <TD> <BR><INPUT TYPE="SUBMIT" VALUE=" Upload "> </TD> </TR> </TABLE> </FORM> <dtml-var standard_html_footer> --------------------------------- Here's my 'AddFile' DTML Method: --------------------------------- <dtml-with "data"> <dtml-call expr="manage_upload(id=REQUEST['FileName'], file=file)"> </dtml-with> <dtml-call "RESPONSE.redirect('./FileList')"> --------------------------------- You will need to modify the AddFile method a bit to specify the folder in which you want to store the file. Hope that helps. Eric. -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Todd Loomis Sent: Friday, August 17, 2001 8:13 AM To: zope@zope.org Subject: [Zope] File uploader All: I need to make a file uploader which can upload to a specific folder(selected by the user in the form) and set permissions. Can anybody help I''m having major problems! Thanks, Todd _______________________________________________ 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 )
I keep getting this error after trying this code: Error Type: NameError Error Value: manage_upload At 08:50 AM 8/17/2001 -0700, you wrote:
Hi Todd, Do you want to store your files on the local file system or in Zope as File objects? Either way, have a look at how the 'Add File' form works in Zope. That'll show you how to get the file up to Zope. From there you will need to move it to the folder you want. I upload to a LocalFS object ('data'). Here's the form used to collect the file name: --------------------------------- <dtml-var standard_html_header> <H2><dtml-var document_title></H2> Select the file you want to upload from your local drive by clicking the "Browse" button.<br> Then, click the "Upload" button.<br>
<FORM ACTION="AddFile" METHOD="POST" ENCTYPE="multipart/form-data"> <TABLE CELLSPACING="2"> <TR> <TD ALIGN="LEFT" VALIGN="TOP"> <STRONG>File Name</STRONG> </TD> <TD ALIGN="LEFT" VALIGN="TOP"> <input type="text" name="FileName" size="40"> </TD> </TR> <TR> <TD ALIGN="LEFT" VALIGN="TOP"> <STRONG>File</STRONG> </TD> <TD ALIGN="LEFT" VALIGN="TOP"> <INPUT TYPE="file" NAME="file" SIZE="25" VALUE=""> </TD> </TR> <TR> <TD></TD> <TD> <BR><INPUT TYPE="SUBMIT" VALUE=" Upload "> </TD> </TR> </TABLE> </FORM> <dtml-var standard_html_footer> ---------------------------------
Here's my 'AddFile' DTML Method: --------------------------------- <dtml-with "data"> <dtml-call expr="manage_upload(id=REQUEST['FileName'], file=file)"> </dtml-with> <dtml-call "RESPONSE.redirect('./FileList')"> --------------------------------- You will need to modify the AddFile method a bit to specify the folder in which you want to store the file.
Hope that helps.
Eric.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Todd Loomis Sent: Friday, August 17, 2001 8:13 AM To: zope@zope.org Subject: [Zope] File uploader
All:
I need to make a file uploader which can upload to a specific folder(selected by the user in the form) and set permissions. Can anybody help I''m having major problems!
Thanks, Todd
_______________________________________________ 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 )
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Todd Loomis Web Developer (SAIC) Defense Modeling & Simulation Office 1901 N. Beauregard Street, Suite 500 Alexandria, VA 22311 Office: 703.824.3407 Fax: 703.379.3778 tloomis@dmso.mil
Todd, Are you using a LocalFS object or trying to store the files as Zope File objects? Eric. -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Todd Loomis Sent: Friday, August 17, 2001 9:04 AM To: eric@walstads.net; zope@zope.org Subject: RE: [Zope] File uploader I keep getting this error after trying this code: Error Type: NameError Error Value: manage_upload At 08:50 AM 8/17/2001 -0700, you wrote:
Hi Todd, Do you want to store your files on the local file system or in Zope as File objects? Either way, have a look at how the 'Add File' form works in Zope. That'll show you how to get the file up to Zope. From there you will need to move it to the folder you want. I upload to a LocalFS object ('data').
Zope File objects? At 09:46 AM 8/17/2001 -0700, you wrote:
Todd, Are you using a LocalFS object or trying to store the files as Zope File objects? Eric.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Todd Loomis Sent: Friday, August 17, 2001 9:04 AM To: eric@walstads.net; zope@zope.org Subject: RE: [Zope] File uploader
I keep getting this error after trying this code:
Error Type: NameError Error Value: manage_upload
At 08:50 AM 8/17/2001 -0700, you wrote:
Hi Todd, Do you want to store your files on the local file system or in Zope as File objects? Either way, have a look at how the 'Add File' form works in Zope. That'll show you how to get the file up to Zope. From there you will need to move it to the folder you want. I upload to a LocalFS object ('data').
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Todd Loomis Web Developer (SAIC) Defense Modeling & Simulation Office 1901 N. Beauregard Street, Suite 500 Alexandria, VA 22311 Office: 703.824.3407 Fax: 703.379.3778 tloomis@dmso.mil
Todd, Ugh. I should know better than to try to answer a FAQ. :) Have a look at the Mailing List Archives (searchable, courtesy of NIP Ltd (thanks!)) http://zope.nipltd.com/public/lists/zope-archive.nsf/ByKey/3CDF86E3FBF55B3A I think that answers your question. Eric. -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Todd Loomis Sent: Friday, August 17, 2001 9:49 AM To: eric@walstads.net; zope@zope.org Subject: RE: [Zope] File uploader Zope File objects?
Eric: When I use the code bleow I have no problem uploading a file: <dtml-with "folders"> <dtml-call expr="manage_addFile(id=REQUEST['FileName'], file=REQUEST['file'])"> </dtml-with> <dtml-call "RESPONSE.redirect('./index_html')"> However if I want to upload to another folder within the folder i get this error: Error Type: AttributeError Error Value: __div__ Here's the code I used: <dtml-with "folders/folder1"> <dtml-call expr="manage_addFile(id=REQUEST['FileName'], file=REQUEST['file'])"> </dtml-with> <dtml-call "RESPONSE.redirect('./index_html')"> How can I or can this be done? Thanks, Todd At 09:46 AM 8/17/2001 -0700, you wrote:
Todd, Are you using a LocalFS object or trying to store the files as Zope File objects? Eric.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Todd Loomis Sent: Friday, August 17, 2001 9:04 AM To: eric@walstads.net; zope@zope.org Subject: RE: [Zope] File uploader
I keep getting this error after trying this code:
Error Type: NameError Error Value: manage_upload
At 08:50 AM 8/17/2001 -0700, you wrote:
Hi Todd, Do you want to store your files on the local file system or in Zope as File objects? Either way, have a look at how the 'Add File' form works in Zope. That'll show you how to get the file up to Zope. From there you will need to move it to the folder you want. I upload to a LocalFS object ('data').
Todd, you are getting this error because you are trying to divide folders by folder1 ;) You want to use <dtml-with "folders.folder1"> instead. On 17 Aug 2001 14:27:18 -0400, Todd Loomis wrote:
Error Type: AttributeError Error Value: __div__
Here's the code I used:
<dtml-with "folders/folder1"> <dtml-call expr="manage_addFile(id=REQUEST['FileName'], file=REQUEST['file'])"> </dtml-with> <dtml-call "RESPONSE.redirect('./index_html')">
-- "There's never enough time to do | M. Adam Kendall all the nothing you want." | mak@kha0s.org -Bill Watterson (Calvin and Hobbes) | http://www.zopelabs.com
the line "<dtml-with "folders/folder1">" won't work. you cannot use path notation in this statement. it is interpreted as "folders divided by folder1", and folder objects do not define a division operator (__div__). try something like <dtml-with "folders.folder1"> jens On Friday, August 17, 2001, at 02:27 , Todd Loomis wrote:
Eric:
When I use the code bleow I have no problem uploading a file:
<dtml-with "folders"> <dtml-call expr="manage_addFile(id=REQUEST['FileName'], file=REQUEST[ 'file'])"> </dtml-with> <dtml-call "RESPONSE.redirect('./index_html')">
However if I want to upload to another folder within the folder i get this error:
Error Type: AttributeError Error Value: __div__
Here's the code I used:
<dtml-with "folders/folder1"> <dtml-call expr="manage_addFile(id=REQUEST['FileName'], file=REQUEST[ 'file'])"> </dtml-with> <dtml-call "RESPONSE.redirect('./index_html')">
How can I or can this be done?
Thanks, Todd
At 09:46 AM 8/17/2001 -0700, you wrote:
Todd, Are you using a LocalFS object or trying to store the files as Zope File objects? Eric.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Todd Loomis Sent: Friday, August 17, 2001 9:04 AM To: eric@walstads.net; zope@zope.org Subject: RE: [Zope] File uploader
I keep getting this error after trying this code:
Error Type: NameError Error Value: manage_upload
At 08:50 AM 8/17/2001 -0700, you wrote:
Hi Todd, Do you want to store your files on the local file system or in Zope as File objects? Either way, have a look at how the 'Add File' form works in Zope. That' ll show you how to get the file up to Zope. From there you will need to move it to the folder you want. I upload to a LocalFS object ('data').
Hi Todd, Please, no HTML postings to the mailing list. I would try: <dtml-with "folders.folder1"> <dtml-call expr="manage_addFile(id=REQUEST['FileName'], file=REQUEST['file'])"> </dtml-with> <dtml-call "RESPONSE.redirect('./index_html')"> or without dtml-with: <dtml-call expr="folders.folder1.manage_addFile(id=REQUEST['FileName'], file=REQUEST['file'])"> <dtml-call "RESPONSE.redirect('./index_html')"> Have a look at: (http://zope.nipltd.com/public/lists/zope-archive.nsf/ByKey/3CDF86E3FBF55B3A ) for other options. Eric. -----Original Message----- From: Todd Loomis [mailto:tloomis@dmso.mil] Sent: Friday, August 17, 2001 11:27 AM To: eric@walstads.net; zope@zope.org Subject: RE: [Zope] File uploader Eric: When I use the code bleow I have no problem uploading a file: <dtml-with "folders"> <dtml-call expr="manage_addFile(id=REQUEST['FileName'], file=REQUEST['file'])"> </dtml-with> <dtml-call "RESPONSE.redirect('./index_html')"> However if I want to upload to another folder within the folder i get this error: Error Type: AttributeError Error Value: __div__ Here's the code I used: <dtml-with "folders/folder1"> <dtml-call expr="manage_addFile(id=REQUEST['FileName'], file=REQUEST['file'])"> </dtml-with> <dtml-call "RESPONSE.redirect('./index_html')"> How can I or can this be done? Thanks, Todd
participants (5)
-
Chris Withers -
Eric Walstad -
Jens Vagelpohl -
M. Adam Kendall -
Todd Loomis