[Zope] Q: How to replace images through form + dtml

Samu Mielonen ex@uiah.fi
Thu, 21 Oct 1999 18:36:04 +0300


I've been trying to crack the following problem with
no success:

I'm inside a folder:

1999
	10
		10001 (unique article folderish object)
			parrot (image file inside folderish article)
			edit   (dtml-form for editing article properties)
			postit (dtml-method for handling edit-form submissions)


What I want to do is activate the edit method from within 
article folder to edit the article and it's included image
in order to replace the image with another one.

I can access edit method ok and all the article properties
including the contained images are displayed in the edit
form as I want.

I can even click on the <image type=file name=image1> button to choose
another file from my local hard disk to replace the image
inside that article (in this case I want to replace
"parrot" with "birdy").

I can successfully send this form with the included image
to the postit method.

Once inside the postit method, I have the following debugging code:

	<dtml-if "REQUEST.image1">	- Does the form include an included image?
	  Inside the REQUEST.image1 loop<br> - tell I'm inside the if-clause 
	  parrot=<dtml-var parrot><br> - show the contents of the parrot image 
	  image1=<dtml-var image1> - show the contents of the image1 property
	<P>
	  making the dtml-call to replace the image<br>
	  <dtml-call "parrot.manage_upload(REQUEST['image1'])"> 
	<P>
	After dtml-call<br> 
	  parrot=<dtml-var parrot><br>  - show the contents of the parrot image
	  image1=<dtml-var image1><br>  - show the contents of the image1 property
	</dtml-if>

When I run it I get:

	Inside the REQUEST.image1 loop
	parrot=[picture of parrot here]
	image1=c:\file\path\from\disk\birdy.jpg

	making the dtml-call to replace the image
	parrot=[same picture of parrot, unchanged]
	image1=c:\file\path\from\disk\birdy.jpg


My picture of parrot does not get replaced with the picture
of image1 (i.e. birdy.jpg).

What am I doing wrong? I get no error message from any
of the methods (as far as I can tell).

Best regards,
	Samu Mielonen

PS I read the Content managers guide, the How-to examples, Quick reference
   and even the image.py code. I still cant understand this.


--
"The world will not evolve past its current state of crisis
by using the same thinking that created the situation." - Albert Einstein