InfoPath: How do I show local path of attached file instead of attaching the physical file

When using the file attachment control in a 2007 InfoPath form, I want to display the local path where the file was attached instead of attaching the actual file itself.  The path could be a network location, shared drive, etc. and we'd like the path to be 'clickable'.

I've looked around and found ways to get the filename but it doesn't say how to get the entire local file path.  I'm assuming I have to use the file control because we want the browse capability.
LVL 9
skipper68Application Development ManagerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brenda DBusiness Systems AnalystCommented:
You can create an Hyperlink link from the control panel and enter the path to the file.  enter the Drive letter and then the filename. I.e. H:\12345.docx.

When the user clicks on the hyperlink it will open the file up from that location.
0
skipper68Application Development ManagerAuthor Commented:
Thanks Brenda but I had thought this question was deleted due to no responses.  Anyway, here's how I did it for anyone who is having the same problem:
I had to create a button that utilized form code which allowed you to trap the file selection window and get the path of the file which I ultimately put in a URL formatted text box:
AddHandler DirectCast(EventManager.ControlEvents("CTRL77_5"), ButtonEvent).Clicked, AddressOf CTRL77_5_Clicked

Public Sub CTRL77_5_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)
            Dim OFD As OpenFileDialog = New System.Windows.Forms.OpenFileDialog
            OFD.Title = "Select A File"
            If OFD.ShowDialog() = DialogResult.OK Then
                Dim sr As New System.IO.StreamReader(OFD.FileName)
                Dim nav As XPathNavigator = MainDataSource.CreateNavigator
                nav.SelectSingleNode("/my:myFields/my:field7", NamespaceManager).SetValue(OFD.FileName)
            End If
End Sub

Open in new window


This however raised another issue because it was a server side form which was trying to access local resources.  That meant I had to use a Code Signing Certificate to sign the form which was an entirely different issue. :-)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Brenda DBusiness Systems AnalystCommented:
excellent job on the coding. thank you for the update.
0
skipper68Application Development ManagerAuthor Commented:
See my solution above.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
InfoPath

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.