Display attachment on Form
This seems like it should be a no-brainer. Perhaps that is why I'm struggling.
I have a requirement that the user be able to upload an image to a folder, and then have that image display on the form. So I add the Attachment Clip to the form, and the user is able to upload an image file. So far so good. Now they want that image to display on the same form. I thought I could add the image control and link the attachment to the image control. This does not seem to be possible.
Am I missing something really easy here?
Comments
-
No, it's not easy. we have an example here showing how a Rich Text field can be used to display images:
http://www.processmapping.com.au/articles/MetastormBPM91Review/PicturesinGrids.html
0 -
If you use something like Fiddler to see what's actually happening when you download an attachment, you'll see that you're simply calling into an HTTP handler with query string parameters. While not officially supported, knowing the format of that URL along with a little HTML, you could render literal HTML onto the form in a calculated label field that will embed the file using the HTML 'object' tag whose 'data' attribute is the HTTP handler's URL (with appropriate query string). Alternatively you could use an 'iframe' whose 'src' attribute points to that URL.
For example, if you put something like this into a server side script...
public static string EmbedIt(string FolderId, string FileName) { return @"<object width='100%' height='100%' data='/Metastorm/ReadAttachment.ashx?AttachmentFile=" + FileName + @"&AttachmentOwner=" + FolderId + @"&AttachmentType=Folder' type='" + GetMIME(System.IO.Path.GetExtension(FileName)) + @"' standby='Loading...' name='" + FileName + "_Embedded'></object>"; }
...you could then assign the string result to a calculated label field on the form, passing in the 'current' Folder ID and the attachment's filename (stored as a process variable) like so:
ServerSideScript1.EmbedIt(ProcessContext.FolderId,MyProcessProcData1.txtAttachment)
Again, this is unsupported and it is the developer's responsibility to ensure the object/iFrame tag will work as expected in the target environment's browsers.
0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 152 General Questions
- 148 Thrust Services
- 57 Developer Hackathon
- 37 Thrust Studio
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 190 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 10 XM Fax
- Follow Categories