Files
api/services/nginx/app/file_server.php
T
Jepp9350 1e8c60e33a Refactor booking status handling and enhance file checks.
Updated booking logic to include completed bookings in cancellation handling. Added `isFileInStore` to improve file existence checks in the wash certificate store. Adjusted file server logic to use the new method for enhanced clarity and maintenance.
2025-02-03 09:34:09 +01:00

24 lines
816 B
PHP

<?php
// Get the file name from the URL
$file = $_SERVER['REQUEST_URI'];
$file = str_replace('/modules/washcertificates/output/certificates/', '', $file);
// Download the file from minio, and send it to the client
$wash_certificate_store = new \classes\wash_certificate_store();
// Check if the certificate exists
if (!$wash_certificate_store->isFileInStore($file)) {
echo 'Certificate not found in store';
//header('HTTP/1.1 404 Not Found');
exit;
}
// Download the certificate from the store to /tmp
$certificate_path = $wash_certificate_store->download($file);
// Send the certificate to the client
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="' . $file . '"');
header('Content-Length: ' . filesize($certificate_path));
readfile($certificate_path);
exit;