Skip to content

Write a PHP Script to Download Files

Write a PHP code to download file.
This PHP script will allow you to download the PDF file directly without opening it. But if want to add more file support you can do it by adding another pice of code. Place your code where is written “add more file et here”. You can copy the above case but you have to change the IMEI type for file.

First of all create a PHP script called “download.php” and copy the code given below.

Download here
?>

Now, If you want to use this code follow these instruction. Add this pice of code where you want to place your downed link. Don’t forget to change “some_file.pdf” with your file name.

Download here

If you have any question or suggestions, please drop a comment below.