2

The link How can I create a link to a local file on a locally-run web page? doesn't help me, since the problems are not the same

I have the folowwing html code

<a href = "file://link/to/my/local/file/my file.xltx" target="_blank"> Download my file </a>

written inside index.php file

In IE, it works fine, but when coming to Chrome, it doesn't work

I want to force Chrome (or any other browser) to download the file using php script only, whithout using chrome extension or configuration

Can any one help me ? Thanks in advance

Remarks

  • I tried curl method, but the problem is that the php script is server side, so the target location will be relative to server not to client
  • When I copy paste file://link/to/my/local/file/my file.xltx the the chrome adress bar, it works fine
NASSIM ADRAO
  • 145
  • 1
  • 9
  • I'm pretty sure that the problem is due to the space in the link. Try and rename the file to not have a space and see if that works. – Zeth Dec 21 '21 at 10:25
  • 2
    From the duplicate — "You cannot cross from http(s) to the file protocol" — it only works in IE because IE is ancient, insecure junk. – Quentin Dec 21 '21 at 10:26
  • @Zeth In IE it works, when I copy paste `file://link/to/my/local/file/my file.xltx``to chrome adress bar, it works fine Thanks for the remark, I will update the question – NASSIM ADRAO Dec 21 '21 at 10:27
  • @Quentin Is there any alternative way to access local file with secure methods (php only) ? thanks in advance – NASSIM ADRAO Dec 21 '21 at 10:29
  • 1
    PHP on the server cannot access the client's filesystem at all. It would be a major security issue if every website you visit could go poking around your hard disk. – Quentin Dec 21 '21 at 10:31

0 Answers0