1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| if(isset($_GET['id']))
{
$sql = "SELECT * FROM documents where id = '" . mysql_real_escape_string($_GET['id']) . "'";
$qry = mysql_query($sql);
$doc = mysql_fetch_array($qry);
if ( ! empty($doc))
{
$filename = 'nom_du_fichier.pdf';
file_put_contents($filename, $doc['document']);
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="'.$filename.'"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: '.filesize($filename);
@readfile($filename);
exit;
}
} |