20 lines
621 B
PHP
20 lines
621 B
PHP
|
<?php
|
||
|
define("MAIN_DIR", __dir__."/..");
|
||
|
|
||
|
if (!empty($_GET["f"]) && is_file(MAIN_DIR."/content/".$_GET["f"]))
|
||
|
{
|
||
|
$filename = MAIN_DIR."/content/".$_GET["f"];
|
||
|
header('Content-Description: File Transfer');
|
||
|
header('Content-Type: application/octet-stream');
|
||
|
header("Content-Disposition: attachment; filename=\"".$_GET["f"]."\"");
|
||
|
header('Content-Transfer-Encoding: binary');
|
||
|
header('Expires: 0');
|
||
|
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||
|
header('Pragma: public');
|
||
|
header('Content-Length: ' . filesize($filename));
|
||
|
readfile($filename);
|
||
|
exit;
|
||
|
}
|
||
|
else
|
||
|
die ("Fichier introuvable");
|
||
|
?>
|