permission("archivio_documenti") ) { // Peschiamo l'OE $oe = oeManager::getOE($_GET["codice"]); if (empty($oe)) { break; } // Otteniamo il path assoluto del file $path = $_GET["file"]; $realPath = oeManager::getArchiveDocumentPath($oe, $path); if($realPath === false) { break; } // Prendiamo il contenuto del file $file = file_get_contents($realPath); if($file === false) { break; } // Otteniamo il mime type $finfo = new finfo(FILEINFO_MIME); $mime = $finfo->buffer($file); header('Content-Description: File Transfer'); header("Content-Type: {$mime}"); header("Content-Disposition: attachment; filename={$path}"); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); die($file); break; } if ($error) { header('HTTP/1.0 403 Forbidden'); die(); } ?>