Created
August 5, 2016 13:07
-
-
Save phenix-factory/fa3d2d43b0d744a260fdc440fc9935a2 to your computer and use it in GitHub Desktop.
PHP : envoyer un fichier au navigateur
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 | |
$size = filesize($file); | |
header('Content-Description: File Transfer'); | |
header('Content-Type: application/force-download'); | |
header('Content-Type: application/octet-stream'); | |
header('Content-Disposition: attachment; filename='.basename($file)); | |
header('Expires: 0'); | |
header('Cache-Control: must-revalidate'); | |
header('Pragma: public'); | |
header('Content-Length: '.$size); | |
ob_clean(); | |
flush(); | |
readfile($file); | |
exit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment