[Zope] Problem to init a DTML Document by uploading a file

andres@corrada.com andres@corrada.com
Fri, 23 Jun 2000 23:35:14 -0400


On Thu, Jun 22, 2000 at 02:18:35PM +0200, Frédéric Quin wrote:
> Hi all,
> 
> 
> I did'nt manage to init a DTML Document by uploading a file.
> I wrote :
> <dtml-call "manage_addDTMLDocument('my_id_html','','/home/index.html')
> I tried too :
> <dtml-call "manage_addDTMLDocument('my_id_html','',file='/home/index.html')
> And also :
> <dtml-call "manage_addDTMLDocument('my_id_html','',file_path)
> 
> 
> Zope always creates a DTML Document and init his body with the path of the file
> : it never uploads the file...
> I encounter the same problem with manage_addImage which is a bigest problem...
> 

Frederic,

The keyword argument "file" is somewhat misnamed. It should really be called
"fileContents".

I don't know in what context you are using this code but this may clear up
your problem:

Part of the magic that sucks the file out of your computer whenever you use
the browse button to upload the file is provided by the <FORM> tag. Make
sure your tag has the following syntax:

<FORM ... enctype="multipart/form-data"...>

if you do not include this on the tag, the browser will send only the name
of the file to Zope when you use an <input type="file"> tag. If enctype is
specified as shown above, then you will get the contents of the file in
whatever cgi variable you named in your <input> tag.

If you explain why you are calling manage_addDTMLDocument I could be more
helpful.

------------------------------------------------------
Andres Corrada-Emmanuel   Email: andres@corrada.com
------------------------------------------------------