[Zope] Uploading contents of a file
Casey Duncan
casey@zope.com
Tue, 14 May 2002 09:54:44 -0400
Tip: I would highly suggest writing the method below as a python script. =
DTML=20
is not good for coding logic. In python this would look like:
context.manage_addFolder(folderid, foldertitle)
product =3D context[folderid].manage_addProduct['Page Template']
product.manage_addPageTemplate('index_html', foldertitle, file)
Be sure to add folderid, foldertitle and file as arguments to the script.
Now as for your problem, make sure your form containing the file has the=20
attribute=20
enctype=3D"multipart/form-data"
hth,
Casey
On Tuesday 14 May 2002 03:43 am, Marie Robichon allegedly wrote:
> Hi,
>=20
> I have written a method to create a folder with a page template=20
> inside. What I would like to do is provide the user with a form simila=
r to=20
> the edit form with an upload file field in order to place the contents =
into=20
> the page template.
>=20
> I haven' t figured out how to recover the contents of the uploaded=20
> file. How do I access manage_upload, and how do I inject the contents =
into=20
> my page template?
>=20
> My method is :
>=20
> <dtml-call "manage_addFolder(folderid, foldertitle)">
> <dtml-with "_[folderid]">
>=20
> <dtml-call=20
> "manage_addProduct['PageTemplates'].manage_addPageTemplate('index_html'=
,=20
> foldertitle, file)">
>=20
> </dtml-with>
>=20
> In the API it talks about ZPythonScriptHTML_upload, but I don' t have a=
=20
> clue how to use it, am a (struggling) newbie....
>=20
> Thanks for any clues or pointers as to where to find the answers,
>=20
> Marie Robichon
>=20
> Web Task Force
> European Synchrotron Radiation Facility
> BP 220
> 38043 Grenoble Cedex
> France
>=20
> http://www.esrf.fr
>=20
> Tel: (33) 04 76 88 21 86
> Fax: (33) 04 76 88 24 27
>=20
>=20
>=20
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -=20
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>=20