Insert image into a database

See all posts See thread Reply

Re: Insert image into a database new!
by Andrea, 17 years, 10 months ago
I'm actually using this code:

if ($handle->processed) {
  // everything was fine !
  echo 'file uploaded with success';
  echo '';
  $info = getimagesize($handle->file_dst_pathname);
  echo '  ' . $info['mime'] . ' '. $info[0] . ' x ' . $info[1] 
    .' - ' . round(filesize($handle->file_dst_pathname)/256)/4 . 'KB';
  echo 'Image Uploaded!';
  $idprogetto=$_POST["idprogetto"];
  $caption=$_POST["caption"];
  $buy=$_POST["buy"];
  $insert="INSERT INTO `images` (id,idproject,caption,buy,link)".
   "    VALUES (' ','$idproject','$caption','$buy',".
   "'".$handle->file_dst_name."')";
  $risult=mysql_query($insert, $link);
}
Reply
Re: Insert image into a database new!
by colin, 17 years, 10 months ago
What is not working in your code? Do you want to store the image itself in the database, or simply the image path?Reply