Page 1 of 1

opening a pdf from a database

Posted: Mon Feb 09, 2004 1:26 pm
by liljester

Code: Select all

<?php
$query = mysql_query("SELECT file, file_name FROM $table WHERE file_id = $file_id");  
$file = mysql_fetch_array($query);  
header("Content-type: application/octet-stream");  
header("Content-Disposition: attachment; filename=$file[1]");  
print $file[0];
?>
this used to work in IE but doesnt now... anyone know why? Or is there a better way to do it?