Follow the code of the file to display the pdf. This pdf is saved in the database. On a machine with old php it works. However on the online server it generates the corrupted pdf file.
<?php
if (!empty($_GET['id'])) {
$file = $banco = $banco->GetRow("SELECT * FROM up_danf WHERE id = '" . $_GET['id'] . "'");
}
if (!empty($file['nome'])) {
header("Content-Type: application/" . $file["tipo"] . "");
header("Content-Length: " . $file["tamanho"] . "");
header("Content-Disposition: attachment; filename=" . $file["nome"] . "");
header("Content-Description: PHP Generated Data");
header('Cache-Control: private');
header('Pragma: private');
header("Expires: 0");
session_cache_limiter('public');
print $file["conteudo_arquivo"];
}
?>
I put the command header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); and commented header ("Expires: 0");
still not working.
Maybe it helps the php version I'm using is: PHP Version 5.3.17