MySQL Forums
Forum List  »  PHP

Re: STORING IMAGES IN MYSQL DB
Posted by: Collins Abah
Date: June 13, 2005 11:03AM

<?

include_once "db.php";


if (isset($_FILES["fupload"]) && is_uploaded_file($_FILES["fupload"]["tmp_name"]))
{
$content = file_get_contents($_FILES["fupload"]["tmp_name"]);
$filename = $_FILES["fupload"]["name"];

if(!mysql_select_db("practise",$connection))
{
showerror();
}
$query = "INSERT INTO blob_test SET
filename = '{$filename}',
data = '.file_put_contents($content).'";
if (!mysql_query($query,$connection))
{
showerror();
}

if(mysql_affected_rows() == 1)
{
echo "Data Saved";
}
else
{
echo "data havent been saved";
}

}
else
{
echo "cant get picture";
}
?>

Options: ReplyQuote


Subject
Written By
Posted
Re: STORING IMAGES IN MYSQL DB
June 13, 2005 11:03AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.