+ 1
Download
Please can someone teach how to connect download button to a file on a website so that when you click on it it will download
4 Antworten
+ 2
and also the file should be downloadable, not like .php;
make sure it is accessible (has the right permissions)
and don't store .exe, .dll, .ocx and similar files directly. at least compress to zip (zip is the preferred one) without password request.
but .7z is still okay....
for Linux preferred: .tar.gz, .tar.bz2, .tar.xz
and yes, use href for it.
I hope this helps
+ 1
Often times it just connects to an href URL of the file.
+ 1
Here's what I found on web search from SO
https://stackoverflow.com/questions/11620698/how-to-trigger-a-file-download-when-clicking-an-html-button-or-javascript
No one perfect answer you will find there, each and every answer has their good & bad. So it's up to you to implement it in your code and see which one works best for your project.
Good luck!
+ 1
If you must require a button. Just nest the link in the button element.
<button><a href="your file path" download="yourfilename">Download</a></button>
The download attribute will preset the file name.