views:

53

answers:

2

How do I set Href to a file on a server (example: \myserver\test\a.txt) correctly? When I assign the path to Href, it adds the domain name in front (http://mydomain.com/myserver/test/a.txt) which is not the correct path.

+1  A: 

Try using the file:/// URI paradigm. For example, I can go in my browser to file:////sharename/c$/ and it works.

Andrew
@Andrew - Can you give this as a href link in your webpage?.
Sachin Shanbhag
I tried this but it doesn't seem to do the trick.
Prabhu
+1  A: 

You can't download a file from server from your client side. You have to do this on your server side or make sure that the file which you want to give in href is accessible by adding it in your hosted directory.

One of the better way if you dont want to manually move the files on server is to write code on server side to make a copy of that file from any location on that server as specified by you and put it in hosted directory. Once the file is in hosted directory you can create a link and give it to user for download or access.

Sachin Shanbhag