How to open an attachment in an xpage using a link url? What are all the fields iln the url? Pls explain. Also about the document folder created in the 'xsppers' folder.
Asked
Active
Viewed 2,492 times
0
-
2Can this help? http://www.wissel.net/blog/d6plinks/SHWL-86QKNM – Per Henrik Lausten May 24 '13 at 07:27
-
1Also try the File Download control... no URL required. – Tim Tripcony May 24 '13 at 10:27
-
how to use the file download control to display the attachment in the page? – vijay May 24 '13 at 10:40
-
can we set the document id? It's not the same for every attachment. – vijay May 24 '13 at 10:43
-
I'm brand new to xpages. so pls bear with my very basic questions. i need all your help. – vijay May 24 '13 at 10:47
-
where to use the file download control? i used it and associated it with a field in a form which holds the uploaded file. Also i tried creating a view and it too failed to display the file. so how to use the file download control? – vijay May 24 '13 at 11:30
1 Answers
4
The short answer how to open a attached Image is:
http://pathToyourDatabase/DatabaseName.nsf/0/DocumentUniversalID/$File/MyImage.jpg
you can create this link with:
var imageurl = facesContext.getExternalContext().getRequest().getContextPath() + "/0/" +
/*in my case: viewEntry.getDocument().getUniversalID()*/
+ "/$File/"+ AttachmentName;
placing this link in the src
attribute of an <img>
or in the url
attribute of the <xp:image>
tag will dislay this image on your xPage. This example works fine for me but for other Attachments you maby have to add ?OpenElement
after the AttachmentName.
Update:
I did a short experiment on this with a pdf file and it worked without the ?OpenElement
just use the code to generate the url it should work. Additional you can look @ Link.

Community
- 1
- 1

Michael Saiz
- 1,640
- 12
- 20
-
As in the profiles, how to add a place for an image and let users upload image to display in that place? similar to profile picture setting. – vijay May 24 '13 at 10:46
-
4Nota bene: doesn't work that way in an XPiNC app. You want to use http://www.wissel.net/blog/d6plinks/SHWL-86QKNM – stwissel May 27 '13 at 00:40