exec("SELECT file_path FROM pmsi.p_mat2a_file WHERE mat2a_import_id = $import_id"); if ($result != false) { $record = $database->nextRecordInto(); if ($record != FALSE) { $file_name = $record[0]; $ok_import = TRUE; } } if ($ok_import == TRUE) { header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/".substr($file_name,-3)); header("Content-Disposition: attachment;filename=\"" . basename($file_name) . "\""); $result = $database->exec("SELECT data FROM pmsi.p_mat2a_file WHERE mat2a_import_id =$import_id"); $ok = TRUE; while ($ok == TRUE) { $ok = FALSE; $record = pg_fetch_array($result); if ($record != FALSE) { $ok = TRUE; $data = $record[0]; echo uncompress(pg_unescape_bytea($data)); } } } else { echo "Pas de fichier $data_type pour le rapport n° $import_id "; } ?>