Created
March 14, 2018 09:19
-
-
Save pradeep910/4fd077ebe7412210c24a2a0d0bc2b0b3 to your computer and use it in GitHub Desktop.
Download PDF file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$file = "filename.ext"; | |
// Quick check to verify that the file exists | |
if( !file_exists($file) ) die("File not found"); | |
// Force the download | |
header("Content-Disposition: attachment; filename="" . basename($file) . """); | |
header("Content-Length: " . filesize($file)); | |
header("Content-Type: application/octet-stream;"); | |
readfile($file); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment