1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
$local_file = $_GET['path'];
$download_file = $_GET['name'];
$download_rate = 20.5;
if(file_exists($local_file) && is_file($local_file))
{
header('Cache-control: private');
header('Content-Type: application/force-download');
header('Content-Disposition: attachment; filename='.$download_file);
$file = fopen($local_file, "r");
while(!feof($file))
{
print fread($file, round($download_rate * 1024));
}
fclose($file);
exit();
}
else
{
putMessage("le fichier n'existe pas");
} |
Partager