VPN-Management-GUI 2.0.3 porting start
This commit is contained in:
32
Modules/Forum/getattachment.php
Executable file
32
Modules/Forum/getattachment.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
$download = $_GET['download'];
|
||||
|
||||
// Dieses Verzeichnis liegt außerhalb des Document Root und
|
||||
// ist nicht per URL erreichbar.
|
||||
$basedir = $_SERVER["DOCUMENT_ROOT"]."/Modules/Forum/uploads";
|
||||
|
||||
if(strpos($download, "/") === false && strpos($download, "..") === false && $download != "")
|
||||
{
|
||||
$filename = $basedir."/".$download;
|
||||
|
||||
if(file_exists($filename))
|
||||
{
|
||||
// Passenden Dateinamen im Download-Requester vorgeben,
|
||||
// z. B. den Original-Dateinamen
|
||||
$save_as_name = basename($filename);
|
||||
header("Content-Disposition: attachment; filename=\"$save_as_name\"");
|
||||
// Passenden Datentyp erzeugen.
|
||||
header("Content-Type: application/octet-stream");
|
||||
// Datei ausgeben.
|
||||
readfile($filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
die("NO SUCH FILE: ".$filename);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
die("INCORRECT PARAMETER: ".$download);
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user