Re: inserting images into MySQL
| From: | pyramid at pyramid dot pl | Date: | Tue, 04 Jan 2000 20:26:15 +0000 |
| Subject: | Re: inserting images into MySQL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-32699@lists.php.net to get a copy of this message | ||
<?
// add to database
$path="your_file";
$f=fopen($path, "r");
$contents=fread($f, filesize($path));
fclose($f);
$contentsslashes=addslashes($contents);
db_query("insert into images (img) values($contentsslashes)");
?>
<?
// show from database
$qid=db_query("select img from images");
$row=db_fetch_row($qid);
Header("Content-type: image/jpeg");
echo $row[0];
?>
Best rgds
krzysztof.szachun@pyramid.pl
www.PYRAMID.pl