1

I've got a web page on our corporate intranet.

On this page, we (want to) have download links. These links (should) point to files in a DFS share.

The client has access to the DFS share (\domain\share\file.exe) but creating a link directly to file:\domain\share\file is blocked by the browser because it's the webpage trying to access a 'local' file.

Edit: To be clear, the file we want to link to is on a completely different server than the website and is only accessible to the user via a UNC path (it's not a mapped drive or anything).

Without changing the browser settings, how can I make this work?

I'm willing to have some sort of 'pass-thru' php scrip (like this non-working option: PHP - Link to local file) or whatever works. In the end, telling the user to "copy and paste this url into your windows explorer address bar" isn't really a good option.

lowcrawler
  • 6,777
  • 9
  • 37
  • 79

1 Answers1

1

To allow links to local files, these files must be under the DocumentRoot of your site, and you should link them from the Documentroot instead of a full local path.

For example, if your DocumentRoot is at c:\www\mysite, your files should be at a subfolder of c:\www\mysite, for example c:\www\mysite\sharedfiles. And then you have to link them from that folder, for example <a href="/sharedfiles/file.exe">.

If your server is a linux server you could create a symlink from your DocumentRoot to the shared folder. And depending of your server configuration it would work.

Another otpion is to have a PHP file for example that receives a path as a parameter and does a readfile operation, but this is dangerous.

David Rojo
  • 2,337
  • 1
  • 22
  • 44