[Zope] Uploading contents of a file
Robert Rottermann
robert@redcor.ch
Tue, 14 May 2002 10:27:24 +0200
You can do something like folows:
add form and an input tags to your method:
<form name=xy METHOD="POST" enctype="multipart/form-data" action="myscript">
<input type=text name="foldertitle">
<input type=file name="file">
</form>
write a pyton script called myscript:
parameters foldertitle='', file=''
context.manage_addProduct['PageTemplates'].manage_addPageTemplate('index_htm
l', foldertitle, file)
robert
----- Original Message -----
From: "Marie Robichon" <robichon@esrf.fr>
To: <zope@zope.org>
Sent: Tuesday, May 14, 2002 9:43 AM
Subject: [Zope] Uploading contents of a file
> Hi,
>
> I have written a method to create a folder with a page template
> inside. What I would like to do is provide the user with a form similar
to
> the edit form with an upload file field in order to place the contents
into
> the page template.
>
> I haven' t figured out how to recover the contents of the uploaded
> file. How do I access manage_upload, and how do I inject the contents
into
> my page template?
>
> My method is :
>
> <dtml-call "manage_addFolder(folderid, foldertitle)">
> <dtml-with "_[folderid]">
>
> <dtml-call
> "manage_addProduct['PageTemplates'].manage_addPageTemplate('index_html',
> foldertitle, file)">
>
> </dtml-with>
>
> In the API it talks about ZPythonScriptHTML_upload, but I don' t have a
> clue how to use it, am a (struggling) newbie....
>
> Thanks for any clues or pointers as to where to find the answers,
>
> Marie Robichon
>
> Web Task Force
> European Synchrotron Radiation Facility
> BP 220
> 38043 Grenoble Cedex
> France
>
> http://www.esrf.fr
>
> Tel: (33) 04 76 88 21 86
> Fax: (33) 04 76 88 24 27
>
>
>
> _______________________________________________
> 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 )
>