Adding IMAGE with manage_addImage is impossible :)
I can't add an image from a submit form using manage_addImage regardless of whatever I do. Yes, I've read all the documentation (even the source code for image) 10 times already :) I can only manage to save the path of my image (from my local harddrive) as content type text/plain when I use the manage_addImage to try and save the submitted image (not the path). I do not understand what I'm doing wrong. I've tried every single piece of code on the Zope mailing list since 1998 (from archives) concerning manage_addImage and I can only conclude one thing: Adding images is way too difficult :) Here's what I try to do (simplified): within a context of a sub-sub-folder (name is, say 'xyz'): edit.html ========= <form action=postit method=post> <input type=file name="image1"> <input type=submit value="Tallenna muutokset"> </form> postit ====== <dtml-if "image1"> <dtml-call "manage_addImage('temp_img', REQUEST.image1, 'testing images')"> </dtml-if> and the result is a corrupted image file of content type "text/plain" with the size of of my image path in bytes. Both edit.html and postit are inside the same folder and my folderish object can contain image type sub-objects. What am I doing wrong? From above it seems that image1 is a string object, but if so, then where's the uploaded file I'm sending through the submit form? How do I reference it? Is there any way to list all submit form property names (variables) and their contents (values) so that I can easily debug any problem like this? Once again, all help is very much appreciated. Best regards, Samu Mielonen PS Having browsed through all of the Zope mailing list archives I've noticed I was alone with this problem. At least 8 other people had the same problem as I did. How can referencing a simple image object be so darned difficult? :) -- "Our reflections on the order of society, as well as nature, are still dominated by the Newtonian image of massive power, exerted by sovereign agency through the operation of central force..." -Stephen Toulmin, "Cosmopolis"
At 12:13 24-10-99 , Samu Mielonen wrote:
<form action=postit method=post> <input type=file name="image1"> <input type=submit value="Tallenna muutokset"> </form>
Make that <form action=postit method=post encty="multipart/form-data"> so that your browser will actually upload the file, not the path to the file.
PS Having browsed through all of the Zope mailing list archives I've noticed I was alone with this problem. At least 8 other people had the same problem as I did. How can referencing a simple image object be so darned difficult? :)
It is a frequently made mistake, and a problem of HTML, not Zope. Did none of the replies to any of those messages name the solution? -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | T: +31 35 7502100 F: +31 35 7502111 | mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ---------------------------------------------
participants (2)
-
Martijn Pieters -
Samu Mielonen