0

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.

vijay
  • 1
  • 2

1 Answers1

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
  • 4
    Nota 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