Force download
Publié le 13 juillet 2015 | Par adminblog | 1 commentaire
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<?php /*change this to your file location*/ $file_url="http://mywebsite.com/mydirectory/somefile.zip"; /*end change this*/ if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { header('Content-Type: "application/octet-stream"'); header('Content-Disposition: attachment; filename="'.basename($file_url).'"'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header("Content-Transfer-Encoding: binary"); header('Pragma: public'); header("Content-Length: ".filesize($file_url)); } else { header('Content-Type: "application/octet-stream"'); header('Content-Disposition: attachment; filename="'.basename($file_url).'"'); header("Content-Transfer-Encoding: binary"); header('Expires: 0'); header('Pragma: no-cache'); header("Content-Length: ".filesize($file_url)); } readfile($file_url); ?> |
Commentaires récents