Update: 2026-05-04 02:20:59

This commit is contained in:
Hamza-Ayed
2026-05-04 02:20:59 +03:00
parent c6040b3b85
commit 3e9d380e6d
2 changed files with 16 additions and 4 deletions

View File

@@ -24,10 +24,22 @@ if ($decoded['role'] !== 'super_admin' && $invoice['tenant_id'] !== $decoded['te
}
$filePath = $invoice['original_file_path'];
if (!file_exists($filePath)) die('File missing');
if (!file_exists($filePath)) {
error_log("FILE PROXY ERROR: File not found at " . $filePath);
header("HTTP/1.0 404 Not Found");
exit('File missing');
}
if (!is_readable($filePath)) {
error_log("FILE PROXY ERROR: File not readable at " . $filePath);
header("HTTP/1.0 403 Forbidden");
exit('Permission denied');
}
$mime = mime_content_type($filePath);
header("Content-Type: $mime");
header("Content-Length: " . filesize($filePath));
header("Cache-Control: public, max-age=3600"); // Add caching for speed
readfile($filePath);
exit;