[Zope] Using LocalFs in a form embedded in our application

Simon ALEXANDRE simon.alexandre at cetic.be
Wed May 25 11:54:59 EDT 2005


Hi,

 

We are developing a web based application using Zope as webserver.

 

One of our expected features consists in uploading a zip file on the server
and after that to unzip it.

 

Our pages are designed using zpt.

 

I would like to include in one of my pages a simple form allowing to select
a file in the client machine and to upload it on the server (in a dedicated
directory, not in the zope DB).

 

I have installed LocalFS.

 

I try with a form like that in my code (copy/paste from the source code
provided by localFS in zope): 

 

<form action="manage_upload" method="post" enctype="multipart/form-data">
        <input type="file" name="file" size="25"/>
        <input class="form-element" type="submit" value="Add"/>
</form>
 
But nothing happen when I clic on the 'add' button. No upload, no error.
 
NB: this form is encapsulated in a macro (already encapsulated in a form),
is it the cause of the problem?
 
Someone have an idea??
 
Thanks in advance
 
Here is the source code of the macro which encapsulates the form:
 
----------

 

<tr metal:define-macro="Macro_ImportFileSystem">

    <td colspan=5>

      <table cellspacing=0 cellpadding=0 width="100%" align="center">

        <tr height="10px"><td/></tr>

        <tr>

          <td align="center">

             <table cellpadding=0 cellspacing=0 width="350px" align="center"

                    tal:define="paths here/GetCurrentFolderContent">

               <tr><td colspan=3>Files and/or folders to import<img
src="Images/Mandatory"/></td></tr>

               <tr height="3px"><td colspan=3/></tr>

               <tr height="1px" bgcolor="#CCFF60"><td colspan=3/></tr>

               <tr height="25px">

                 <td colspan=3>

                   <input type="image" src="Images/ParentFolder"

                          name="gui_OnChdirpp"

                          style="border-width:
0;background-color:#FFFFFF;width: auto;height: auto"

                          tal:condition="python:
(session['projectCurrentFolder'] not in ('/', '\\')) and (session['user'] !=
'anon')"/>

                   &nbsp;You are in <span
tal:replace="session/projectCurrentFolder">Current dir</span>

                 </td>

               </tr>

             

 

               <!-- Start Form File Upload-->

                                      <tr>

                                      <form action="manage_upload"
method="post" enctype="multipart/form-data">
                               <input type="file" name="file" size="25"/>
                               <input class="form-element" type="submit"
value="Add"/>
                  </form>

                                   

                                      </tr>

               <!-- End Form File Upload-->

 

 

                                      <tr tal:repeat="path paths">

                 <span tal:define="rowBgColor
python:here.Shared.GetInfo('rowColor', paths.index(path))">

                 <td tal:define="pathType python: here.GetPathType(path[0])"

                     tal:condition="python: session['user'] != 'anon'">

                   <input type="image"

                          style="border-width:
0;background-color:#FFFFFF;width: auto;height: auto"

                          tal:condition="python: pathType == 'Folder'"

                          tal:attributes="src python: 'Images/%s' %
pathType;

                                          name python: 'gui_OnChdir_%s' %
path[0]">

                   <img tal:condition="python: pathType != 'Folder'"
tal:attributes="src python:'Images/%s' % pathType"/>

                 </td>

                 <td tal:attributes="bgcolor rowBgColor">

                   <input type="checkbox"

                          tal:attributes="style python:'border-width:
0;;background-color:%s' % here.Shared.GetInfo('rowColor',
paths.index(path));

                                          checked
python:here.IsInImportInfo(path[0]);

                                          name  python:'cbfc_'+path[0];

                                          disabled python:session['user'] ==
'anon'">

                 </td>

                 <td tal:attributes="bgcolor rowBgColor"

                     tal:condition="python: path[1]" tal:content="python:
path[0]" width="100%">

                 </td>

                 <td tal:attributes="bgcolor rowBgColor"

                     tal:condition="python: not path[1]"
tal:content="python: path[0] + ' [removed]' " width="100%">

                 </td>

                 </span>

               </tr>

               <tr tal:condition="not: paths">

                 <td colspan=3><i>The folder is empty.</i>

                 </td>

               </tr>

               <tr height="3px"><td colspan=3/></tr>

               <tr height="1px" bgcolor="#CCFF60"><td colspan=3/></tr>

               <tr tal:condition="python: session['mode'] == 'Update'">

                 <td colspan=3 align="right">Do not update files and
folders&nbsp;

                   <input type="checkbox" name="pjIgnorePaths"
style="border-width: 0;background-color:#FFFFFF"

                          tal:attributes="checked
session/projectKeepOriginalInfo;

                                          disabled python:session['user'] ==
'anon'">

                 </td>

               </tr>

             </table>

          </td>

        </tr>

      </table>

    </td>

</tr>

 

 

Simon ALEXANDRE 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20050525/f56d521d/attachment.htm


More information about the Zope mailing list