opening a pdf from a database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

opening a pdf from a database

Post 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?
Post Reply