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
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php