New and updated version of old code.

This commit is contained in:
2024-05-15 21:24:05 +02:00
commit cc1038047e
11 changed files with 448 additions and 0 deletions

26
api/imageDownload.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
if (isset($_GET['filename']))
{
require("../include/appConfig.php");
// Strip only file name form user string so he do not download system configs or whatnot
$file = $appConfig['imagesLocation'].basename($_GET['filename']);
if(!file_exists($file)) die('404 - File not found.');
else
{
// Set appropriate headers
header("Cache-Control: private");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=".basename($_GET['filename']));
header("Content-Type: ".mime_content_type($file));
header("Content-Transfer-Encoding: binary");
// Read the file from disk
readfile($file);
}
}
else echo "404 - File name not found.";
?>