1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
if ( $don['type'] == "pdf") $type = "application/pdf";
else if ( $don['type'] == "doc") $type = "application/msword";
else if ( $don['type'] == "xls") $type = "application/vnd.ms-excel";
else $type = "application/octet-stream";
$dossier = "../../".$don['dossier']."/";
$file = $dossier.$don['nom_fichier'];
$size = filesize($file);
$name = $don['nom_fichier'];
header("Content-disposition: attachment; filename=$name");
header("Content-Type: application/force-download");
header("Content-Transfer-Encoding: $type\n"); // Surtout ne pas enlever le \n
header("Content-Length: ".$size);
header("Pragma: no-cache");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0, public");
header("Expires: 0");
readfile($file); |
Partager