[Zope] File uploader

Eric Walstad eric@walstads.net
Fri, 17 Aug 2001 08:50:05 -0700


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 )