views:

268

answers:

3

My ultimate goal is to allow users to select a file from a dialog as if they are uploading a file. Instead of file being saved to the server, a hyperlink will be generated from the file's path. This hyperlink will then be used on our intranet page in order to open the file located on our network share. Is there any practical way to accomplish this?

I have tried both an HTML file type insert and .Net's FileUpload Control but neither will work since for security reasons the full path of the file is never accessible.

The intranet site is built in VB.Net.

+1  A: 

You would not be able to do this through a regular web page, since a web site gaining access to a file's path would be a gross security violation. One thing you could do is have a control on your page where the server creates a file tree from browsing the network share. Then the user would select the file path from this server-generated tree.

Jacob
Since this is for an intranet site, this functionality would not be a big security concern. I will try your suggestion of generating a file tree from the server's view of the network share.
sglantz
A: 

suppose your network share drive is the S: drive

if you use plain old file:// style URI's the links will auto open to your files on the share drive.

i.e. file://s:\techfiles\myfile.txt

in order to put the file on the share drive, you must be running that webapp on the share drive server(or have access to it), so just save that file off to the share server, then generate the path. The fact that the webapp server temporarily holds on to the file before storing it shouldn't bother you too much...

Zak
The OP wasn't asking about how to upload files.
Jacob
I know. he was asking how to put them on the share drive. upload it, then save it to the share drive and generate your link.
Zak
Also, since the file may already be on the share drive and he just wants a link to it, he could use a dir list command to list the files and have them selected right from the page itself instead of uploading/saving. It's easy to write a php script to list the contents of a directory on a server... It's also easy to munge filenames if the webapp driveletter to the share drive and the user's desktop drive letter differ...
Zak
Sorry if I wasn't clear, I was looking for a way of finding out the files path so I could link directly to it on the network share. I never planned for the file to be uploaded or copied. I just used that as an example of what the functionality should look like.
sglantz
A: 

Where is the file to uploader?

The Media Annexes
I am not sure what you mean by this, care to elaborate?
sglantz