Re: How to store an image into a mysql database using php language?
| From: | lallous | Date: | Thu, 25 Jul 2002 13:31:53 +0000 |
| Subject: | Re: How to store an image into a mysql database using php language? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109485@lists.php.net to get a copy of this message | ||
insert into table(imagefield) values(load_file('/path/to/image.jpg'))
i remember that worked for me.
//elias
"Rija" <rija@vatu.com> wrote in message
news:001501c231f5$72337a40$3d00a8c0@workelp3...
I want to store image data into mysql table using BLOB but I don't know how
to read it after. To record the image, I doesn't have any problem, but to
read the file after and to view the image, I can't do anything the variable
show only comment like this: memobin24.bin
So how can I do?
This was the script.
<?
Include("connect.inc") ;
$fp = fopen("image/photo.jpg","r") ;
if ($fp) {
$code2 = "" ;
while (!feof($fp)) {
$buffer = fgets($fp, 4096);
$code2 = $code2.$buffer;
}
}
$code2 = addslashes($code2) ;
$table = 'image' ;
$instruction = mysql_query("INSERT into $table values ('','fichier
inage','$code2','') or die("FATAL ERROR") ;
?>