By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,820 Members | 1,051 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,820 IT Pros & Developers. It's quick & easy.

UNC Path from Share Drive

P: n/a
Is there a way on a button press to create a browse for a file box and
then when they pick a file on a share drive to convert it to a UNC
path and that way I would save the unc path into a table and not have
to store the file? If anyone has a solution to getting the UNC path I
would love it. Please.

Feb 9 '07 #1
Share this Question
Share on Google+
3 Replies

P: n/a
On Feb 9, 2:49 pm, "wreed" <whr...@gmail.comwrote:
Is there a way on a button press to create a browse for a file box and
then when they pick a file on a share drive to convert it to a UNC
path and that way I would save the unc path into a table and not have
to store the file? If anyone has a solution to getting the UNC path I
would love it. Please.
I do this on our Intranet - and seeing as you are storing UNC paths
I can only assume this is also for your own intranet as internet
clients
won't be able to see the same LAN as internet servers.

This works on Windows IE 6 and 7 - basically use two input
elements, one a text input, the other a file input, then copy the
path from the file input to the text input when it changes.

You could make sure it is a UNC path on the way I suppose.
Note that the second input has no name attribute. This stops
the file contents being submitted with the form.

<form action="destination.page" method="post">
<input type="text" name="filepath" value="">
<input type="file" style="width:0px;" title="browse for file"
onchange="this.form.filepath.value = this.value;">
</form>

In firefox 2, the dummy file input element is not collapsed, so
you see two copies of the path. But we don't (yet) support firefox
on our intranet as we use a lot of activeX components to display
3D models.

Test it at http://www.chthonic.f9.co.uk/test/filebrowsetest.htm

Feb 9 '07 #2

P: n/a
How does this change it to a UNC path, all I see is once I browse the
Z:\whatever not the \\servername\blah.....

Am I missing something?

ne**@chthonic.f9.co.uk wrote:
On Feb 9, 2:49 pm, "wreed" <whr...@gmail.comwrote:
Is there a way on a button press to create a browse for a file box and
then when they pick a file on a share drive to convert it to a UNC
path and that way I would save the unc path into a table and not have
to store the file? If anyone has a solution to getting the UNC path I
would love it. Please.

I do this on our Intranet - and seeing as you are storing UNC paths
I can only assume this is also for your own intranet as internet
clients
won't be able to see the same LAN as internet servers.

This works on Windows IE 6 and 7 - basically use two input
elements, one a text input, the other a file input, then copy the
path from the file input to the text input when it changes.

You could make sure it is a UNC path on the way I suppose.
Note that the second input has no name attribute. This stops
the file contents being submitted with the form.

<form action="destination.page" method="post">
<input type="text" name="filepath" value="">
<input type="file" style="width:0px;" title="browse for file"
onchange="this.form.filepath.value = this.value;">
</form>

In firefox 2, the dummy file input element is not collapsed, so
you see two copies of the path. But we don't (yet) support firefox
on our intranet as we use a lot of activeX components to display
3D models.

Test it at http://www.chthonic.f9.co.uk/test/filebrowsetest.htm
Feb 9 '07 #3

P: n/a
On Feb 9, 6:08 pm, "wreed" <whr...@gmail.comwrote:
How does this change it to a UNC path, all I see is once I browse the
Z:\whatever not the \\servername\blah.....

Am I missing something?
Your users are selecting a mapped drive to get to the share?
Well, no wonder it doesn't work. I thought your problem
was how to get the path instead of the file itself, not how
to translate a local mapped-drive path into a UNC path

Solutions... 1) Get them to type the UNC path instead. OK,
it sounds flippant, but moving over to using, say, DFS to
manage your shared storage locations is hugely, hugely better
than using mapped drives.

2) on the server, get the mapped drive path, and use WMI
to query the client machine for a list of mapped drives,
lookup z: and substitute the UNC path. This will work if
the server-side code has enough privileges to do the query
and the client computer isn't so busy that it takes ages
to reply. You won't be able to do this client-side.
Feb 12 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.