There is a link to the URL to the file and download attribute. When you try to download a file, it knocks out "Network Error". The link code looks like this:

echo "<td><a href='" . $r['link'] . "' download=''>Ссылка</a></td>"; 

The links themselves are stored in this form:

 C:\OSPanel\domains\dipl\web\upload\jxlrwtest.xls 

I tried it in mozilla, chrome and IE - in mozilla and chrome "Network Error", in IE it does not display anything and does not download the file. Help find a solution.

  • Perhaps the file for this link does not exist. It seems to me that C:\OSPanel\... looks like a link to a local file, not on the server, but on the computer. Just checked your code on working links - it works! - Egor Randomize
  • Well, ospanel is a folder with an open server. And then the project itself - Andrew
  • You need to specify a link like domain.ru / upload / jxlrwtest.xls C: \ OSPanel \ ... this is a local path - Anatoly

1 answer 1

JS security policy does not allow you to access files on the user's disk. I mean, you should not use local links to work with the download tag.

Your code on external links works!

Upload your project along with the working files to external hosting, and downloading files will work as it should!

  • Yes, corrected links and everything works as it should. Thank you very much - Andrew