Fix last commit
This commit is contained in:
parent
e78671e93a
commit
47496a93e1
|
@ -16,5 +16,3 @@ RewriteRule ^(.*)$ $1/ [L]
|
|||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME}\.php -f
|
||||
RewriteRule ^([^\.]+)/$ $1.php
|
||||
|
||||
ForceType application/octet-stream
|
||||
|
|
17
file.php
17
file.php
|
@ -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'];
|
||||
|
|
Loading…
Reference in a new issue