Fix last commit

This commit is contained in:
Jacob 2023-10-15 19:42:54 +02:00
parent e78671e93a
commit 47496a93e1
2 changed files with 14 additions and 5 deletions

View file

@ -16,5 +16,3 @@ RewriteRule ^(.*)$ $1/ [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^\.]+)/$ $1.php
ForceType application/octet-stream

View file

@ -33,9 +33,20 @@ $DatabaseQuery = $Database->query('SELECT * FROM uploads');
while ($line = $DatabaseQuery->fetchArray()) {
if ($line['id'] == $id) {
if ($Action != "view") {
$File = $line['file'];
header("Location: $File");
die();
$File = $_SERVER['DOCUMENT_ROOT'] . $line['file'];
if (file_exists($File)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($File));
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($File));
readfile($File);
}
exit;
} else {
$BaseFilename = basename($line['file']);
$ID = $line['id'];