| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- // Il percorso al file DICOM sul server
- require_once '../../App/bootstrap.php';
-
- $attachId = isset($_GET['attach_id']) ? $_GET['attach_id'] : 0;
- if (!$user->isLogged()) {
- //exit(0);
- }
-
- $attach = $db->where('id', $attachId)->getOne('requests_attachments');
- $file_name = $attach['file_name'];
-
- $dicomFilePath = ATTACH_DIR . $file_name;
-
- // Verifica che il file DICOM esista
- if (file_exists($dicomFilePath)) {
- // Imposta l'intestazione Content-Type per il file DICOM
- header('Content-Type: application/dicom');
-
- // Indica la lunghezza del file in modo che il client possa sapere quanto è grande
- header('Content-Length: ' . filesize($dicomFilePath));
-
- // Disabilita la memorizzazione nella cache per assicurarsi che il file venga sempre caricato
- header('Cache-Control: no-cache, must-revalidate');
- header('Expires: 0');
-
- // Leggi e trasmetti il file DICOM come se fosse il contenuto della risposta
- readfile($dicomFilePath);
- exit();
- } else {
- // Restituisci un errore 404 se il file non viene trovato
- http_response_code(404);
- echo "File non trovato.";
- }
- ?>
|