Hey all,
Having this weird problem writing files binary to mySQL. I have adjusted my php and mySQL ini files as far as sizes are concerned and can upload any file type binary and view it no problem, except PDF files.
Every PDF file I upload regardless of size, when opened from the DB, gives an 'Unknown Error' and displays nothing. The file size shows correct. But I am unable to view them at all once uploaded into the DB.
Other docs work fine: DOC, XLS, GIF, JPG, MPEG, AVI, QB files, anything except PDF files .... /shrug ... have been unable to find any resolve to this.
Here is the code I use to write the file binary to the DB (and I am specifying multipart form data in the form as well).
<?php
if ($addDoc == 'Attach to Manifest')
{
if (isset($binFile) && $binFile != "none")
{
$data = addslashes(fread(fopen($binFile, "r"), filesize($binFile)));
$sql = "UPDATE table SET docHolder = '$data'";
$result = mysql_query($sql);
if (!($result)){print mysql_error();exit;}
mysql_free_result($result);
}
mysql_close();
}
?>
binFile is the field in which the users browses on their system to select a file.
Much Appreciation for any help,
Moon