Xpages - how do i create a file hyperlink?

I found this post that tells me it’s possible to create hyperlinks to files from xpages.

http://www-10.lotus.com/ldd/nd85forum.nsf/5f27803bba85d8e285256bf10054620d/1bc29425ba54fcf185257640003cb404?OpenDocument

However, I must be missing something because I cannot get it to work. I tried to get this file

file:///c:/bobp/temp.txt

by putting it as the url value of a link control and as putting in an href tag directly on the source view, but neither worked. How do I do this?

Thanks,

Bob

Subject: Work around solution

Well, after much investigation and a call into IBM, it’s become apparent that getting the file path programmatically from an upload control to store as a file link just isn’t possible (as far as I can tell).

So, my solution was to simply put another edit box (FileLink) below the upload control for the file path. Then, I added help text below the upload control that reads “Copy the file path to the field below to create a file hyperlink.”

My form allows either an attachment or file hyperlink, so if the user copies the filepath from the upload control into the hyperlink field, then I use clientside js to clear the upload value before the document is saved.

To launch the file, I use a link control with this code:

var filepath = XSP.getElementById(“#{id:FileLink}”);

window.open(“file:///” + filepath.value)

Hope this helps someone else.

Subject: Open File

Are you trying this for XPags in Notes Client or through a browser? I know that the client handles urls differently. It generates a url using 127.0.0.1 with a port number and using a java function in the xsp folder.

Subject: this would be for a browser

I’ve used the Execute command in the client before, but @commands aren’t available in the browser.

Subject: Problem Locally?

I’m having the same problem linking to a file on my C drive. Anything on a shared network drive is fine, it just won’t work with the C drive. I’m having the same problem whether it’s an xp:link or a normal anchor, whether in an XPage or using pass-thru HTML on a Notes form previewed on the web. It seems to be a problem with accessing the C drive rather than specifically XPages. Can the file be on a shared network drive or does it have to be local?

Subject: actually, yes, it will be on a shared drive…

I was just using a file on my c drive for testing. I don’t have a network connection to my customers shared drives, so I can’t test that yet. But, in production, the users will be linking files on shared drives.