Problem to init a DTML Document by uploading a file
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
On Thu, 22 Jun 2000, FrИdИric Quin wrote:
Zope always creates a DTML Document and init his body with the path of the file : it never uploads the file...
Zope should not download the file itself - imaging the situation when you work on one computer, and Zope on another. What is the file /path/to/xxx.html - your local or Zope's? Instead of putting the path, put a content of the file yourself. Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd@phd.russ.ru Programmers don't die, they just GOSUB without RETURN.
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 ------------------------------------------------------
Sorry, Forgot to add that method="post" is also required in the <FORM> tag before a file contents is sent along in a posted form. So the required syntax is: <FORM ... enctype="mulipart/form-data" ... method="post"...> Otherwise, the file-selection field in the form acts like a regular text field. ------------------------------------------------------ Andres Corrada-Emmanuel Email: andres@corrada.com ------------------------------------------------------
participants (3)
-
andres@corrada.com -
Fr�d�ric Quin -
Oleg Broytmann