RE: [PHP-WIN] XML parsing
| From: | Aziz Durmaz | Date: | Fri, 10 May 2002 10:51:31 +0000 |
| Subject: | RE: [PHP-WIN] XML parsing | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13683@lists.php.net to get a copy of this message | ||
Hi,
I have a problem with inserting image into the mysql database (Blob field)
with php codes...
How can i insert a image into the mysql DB with php codes...
I find some codes but they are not work....
Sample code to upload .......
<?php
if (isset ($actionflag) && $actionflag=="upload"){
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
$contents = addslashes($contents);
$conex = mysql_connect ("localhost", "root", "metaz");
mysql_select_db("usarice", $conex);
$sSql = "insert into upload (resim) values ('" . $contents . "')";
$result = mysql_query($sSql, $conex);}
?>
<html>
<body>
<title>Upload</title>
<form action="<?php print $php_SELF; ?>"
enctype="multipart/form-data">
<input type="file" name="filename">
<input type="hidden" name="actionflag" value="upload">
<br>
<input type="submit">
</form>
</body>
</html>
Sample code to show
<?
header ("Content-type: image/gif");
$conex = mysql_connect ("localhost", "root", "metaz");
mysql_select_db("usarice", $conex);
$sSql = "SELECT resim FROM upload";
$result = mysql_query($sSql, $conex);
$row = mysql_fetch_array($resultado, MYSQL_ASSOC);
ob_start();
echo $row[resim];
ob_end_flush();
?>
thanks...
Aziz Durmaz