PDF Blob Error
I have been able to upload a pdf and store it in the mysql database table. In phpMyAdmin I can verify that the pdf is the correct size. However when I try to download the file the document comes back blank and I get an error saying that acrobat could not open the file 'filename.pdf' because it is either not a supported file type or because the file has been damaged. The download code:
$nid = mysql_real_escape_string($_GET['nid']);
$sql = "SELECT name,type,size,article FROM newsarticles WHERE newsid='$nid' AND active=0";
$result = mysql_query($sql);
$data = mysql_result($result, 0, "article");
$name = mysql_result($result, 0, "name");
$size = mysql_result($result, 0, "size");
$type = mysql_result($result, 0, "type");
//die ("The name is $name, the size is $size and the type is $type.");
header("Content-Disposition: attachment; filename=$name");
header("Content-Description: PHP Generated Data");
The query is working correctly because the die line has the correct information for the article.
Why am I unable to correctly download the pdf which has been stored as a blob?
Thanks in advance,