User Generated Hyperlinks to Files Hosted on a Network Share
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开发者_C百科. 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.
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.
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...
精彩评论