Hi, I have here a code for saving a pdf file to mysql database as blob. may problem is how can i retrieve pdf blob in php. thank you.
<?php
if(isset($_POST['add']) && $_FILES['filename']['size'] > 0)
{
$fileName = $_FILES['filename']['name'];
$tmpName = $_FILES['filename']['tmp_name'];
$fileSize=$_FILES['filename']['size'];
$fileType = $_FILES['filename']['type'];
$fileType=(get_magic_quotes_gpc()==0 ? mysql_real_escape_string(
$_FILES['filename']['type']) : mysql_real_escape_string(
stripslashes ($_FILES['filename'])));
$fp = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}
$sql2="UPDATE productitem SET filename = '$fileName', file = '$content', type = '$fileType', size = '$fileSize' where itemcode='$itemcode'";
mysql_query($sql2);
?>