x-pert

Member
Jun 13, 2006
20,952
77
0
mokak ?

Add a picture?

hodama wade machang table eke aluth field ekak hadala image location eka save karanna table eke.
 

codekadiya

Member
Jul 20, 2006
1
0
0
Colombo, Sri Lanka
Basically what you have to do is read the content of the image file and store it in the database table field. Please note that your table field should be a blob type.. the options are
  • TINYBLOB
  • BLOB
  • MEDIUMBLOB
  • LONGBLOB
Once you have setup the table with above field (let's say fieldname is 'content').. You can do this way with PHP:
PHP:
$tmpName = "myimage.jpg";
$fp      = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);

$query = "INSERT INTO gallery (content ) ".
"VALUES ('$content')";

mysql_query($query) or die('Error, query failed');

Hope this helps..