[Zope] Adding IMAGE with manage_addImage is impossible :)

Samu Mielonen ex@uiah.fi
Sun, 24 Oct 1999 13:13:05 +0300


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"