dvm/admin/downpdf.php
2022-11-28 10:27:30 +01:00

27 lines
757 B
PHP
Executable File

<?php
require_once("../config.inc.php");
if($_SESSION["global_username"] == ''){
echo"<script type='text/javascript'>window.top.location.href = \"index.php\";</script>";
exit;
}
$file = $_GET["file"];
if (file_exists($file)) {
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=" . urlencode(basename($file)));
header("Content-Type: application/download");
header("Content-Description: File Transfer");
header("Content-Length: " . filesize($file));
flush(); // This doesn't really matter.
$fp = fopen($file, "r");
while (!feof($fp)) {
echo fread($fp, 65536);
flush(); // This is essential for large downloads
}
fclose($fp);
}else{
echo "Datei nicht gefunden";
}
?>