survey/admin/old/downpdf.php
2023-03-14 14:47:50 +01:00

29 lines
823 B
PHP

<?php
require_once("../config.inc.php");
if($_SESSION["global_username"] == ''){
echo"<script type='text/javascript'>window.top.location.href = \"index.php\";</script>";
exit;
}
$file = str_replace('%2F', '/', urlencode($_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";
}
?>