Displaying an attached image

Hi Everyone.

I know this is an easy one for You (not a newbee programmer).

I have a fileupload in a form and would like to display the uploaded attachment(image)in the document (on the web).

Please help me , I´ve tried to find the solution in this forum without result.

Thank You.

Subject: Displaying an attached image.

“<img src="/” + @WebDBName + “/0/” @Text(@DocumentUniqueID) + “/$File/” + @AttachmentNames + “">”

will display ALL attachments on that document because @AttachmentNames returns a list. If there is one, then one is displayed. In this situation I usually hide the fileupload control if @AttachmentNames =! “” so that the user is limited to one.

Here is the full code from one of my application:

filename := @AttachmentNames;

ID:=@Text(@DocumentUniqueID);

tURL := “<A HREF="/” + thisdb + “/0/” + ID + “/$FILE/” + filename + “" target="_new">”;

url := “<img align=right hspace="5" border="none" src="/” + thisDB + “/0/” + ID + “/$File/” + filename +“" width="200">”;

@If(@IsDocBeingEdited | @Attachments=0; “”; turl + url + “” )

There are some extra HTML attributes listed here. align=right is allowing the text to wrap around the image. width=200 sizes the image to be no wider than 200 so that if a user uploads a large image it will not disrupt the rest of my site layout. I also place an anchor link around the image that will launch the full size image in a new browser window.

I place this field immediately to the right of my body field and the body text wrapps neatly around the image.

Hope this helps,

Marc

Subject: RE: Displaying an attached image.

Thanx Marc !

It works perfekt.

And thanx for the quick response.

Robert