This is a basic feature post, but I wrote it to keep it handy.
If you need to link a document/picture/video or whatever file in your website, you can do it using an a-tag <a href...> link </a> , but what if you want to force this file to be download by the user instead of be opened by the browser?
To do that, you'll need to write a bridge script between the page and the file, and then the link as it follows:
Then in the file download.php, the important code will be:
You can change the content-type to help browser identifying the file type. Below I attach a list of the most common/used:
Another way would be using fileinfo or other functions available in php to query a file.