Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
1.60/5 (2 votes)
I am trying to give user option to upload file in an application. So user can browse the file using upload control and can

1- upload the file to the database
2- If the file is sensitive an duser don't want to upload it to the database , s/he can upload the full path of the file to the database which should then open by clicking the path link

1 is easy to do and I have already implemented it. But with 2 there are few issues:

a- getting the full path (there is no standard among browsers for this i.e. it shows
1- full path in IE9
2- only file name in firefox
3- C:\FakePath\ and file name in chrome.

)

b- How to open it from a webpage

As far as I have researched it is not possible to get the full path due to security issues perceived by the browsers. Also opening the local file from http is not possible.

So My question is that how would you guys implement this requirement ?
Posted
Updated 8-Jan-14 5:31am
v3
Comments
Maarten Kools 8-Jan-14 10:17am    
Our web application contains a Java Applet that handles the whole local client access issue. As you said, security settings will prevent you from getting the full path, and as far as I know only a signed applet will be able to circumvent the issue.

You can also let the applet handle opening the file from disk.

Here's an example[^] on how to handle JavaScript-Java communication.
[no name] 8-Jan-14 10:26am    
But that would require users to install JRE. Right ?? I am looking for something in .Net.
Maarten Kools 8-Jan-14 10:37am    
Yes, the applet runs on the client's machine. I'd love to know a different way to break out of the browser's sandbox, because using a signed applet is far from ideal (for example when Oracle decides to change the security model *sigh*), but as far as I know there isn't any. So if you really need this functionality, a signed Java applet is the way to go.
[no name] 8-Jan-14 10:39am    
Is there any .net equivalent ?
Maarten Kools 8-Jan-14 10:44am    
I believe Silverlight also runs in a sandbox. Breaking out of the sandbox requires a change in policy files on the client machine, and that might not even apply to silverlight apps running in a browser (not sure). Perhaps someone else has a better solution for this issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900