[Zope] Using LocalFs in a form embedded in our application
David Siedband
david at generation-xml.com
Wed May 25 17:45:01 EDT 2005
Simon,
I use LocalFS for something similar in one of my apps. I submit to a
python script that has some code like this:
container.Files.manage_addProduct['OFSP'].manage_addFile(id, title='',
file=file)
where "Files" is the name of my LocalFS object name.
Do you have the ZipFolder product installed? If not you should check
that out.
cheers
--
David Siedband
Oceanic Sky New Media
http://oceanicsky.com
On May 25, 2005, at 8:54 AM, Simon ALEXANDRE wrote:
> 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')"/>
> 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
> <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
>
> _______________________________________________
> Zope maillist - Zope at 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 )
More information about the Zope
mailing list