Last active
August 29, 2015 13:58
-
-
Save buonzz/10247308 to your computer and use it in GitHub Desktop.
download file via mod_xsendfile
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 = 'monkey.gif'; | |
if (file_exists($file)) { | |
//show the download dialog to the browser | |
header('Content-Type: application/octet-stream'); | |
header('Content-Disposition: attachment; filename='.$file); | |
//send away and exit the script, Apache will handle the outputting of file contents | |
header('X-Sendfile: /home/darwin/'.$file); | |
exit; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment