nick nick - 2 months ago 15
HTML Question

html download attribute filepath issue

I am trying to use the download attribute to get a document from my filesystem, but when I click I get failed - no file. As far as I can tell from other examples, the path looks ok but still nothing. Also, the full link when I check in inspector is mysite/filepath as if its a page on the site, is that how it normally is or am I doing something wrong here? The directory with the files is /var/www/files and the file name is correct.

Here is the relevant html

<table>
<other rows here>
<td>
<a href="/var/www/files/filename.extension">Download</a>
</td>
</table>


I get no error and my access log shows the following:

"GET /var/www/doctor_files/06-10-2016-17-30-DetectRTC%20(2).jpg HTTP/1.1" 404 582

Answer

You have to specify relative path to your root web server. Wich is usually /var/www/, so omit this part. Try:

<a href="/files/filename.extension">Download</a>