cksraj Posted November 5, 2009 Share Posted November 5, 2009 Hi All Is it possible to store the image in MySql database using PHP? If yes then what are the steps should I follow to store and retrive it back? Thanks Crew Raj Link to comment https://forums.phpfreaks.com/topic/180402-store-image-in-mysql-and-retrive-the-image-back-to-html/ Share on other sites More sharing options...
canabatz Posted November 5, 2009 Share Posted November 5, 2009 this code is to store it in the database: $upload_dir="item_images"; if(!is_dir($upload_dir)) { mkdir($upload_dir,0777); } $item_image1=$_FILES['item_image']['name']; $item_image=TIME().$item_image1; $up_dir=$upload_dir.'/'.$item_image; if(move_uploaded_file($_FILES['item_image']['tmp_name'],$up_dir)) { "File Item Image Uploaded"; } else { "Item Image does not uploaded"; } Link to comment https://forums.phpfreaks.com/topic/180402-store-image-in-mysql-and-retrive-the-image-back-to-html/#findComment-951710 Share on other sites More sharing options...
canabatz Posted November 5, 2009 Share Posted November 5, 2009 sorry ,you need the insert too! $sql="INSERT INTO `yourtable` (`item_image`) VALUES ('$item_image')"; mysql_query($sql); Link to comment https://forums.phpfreaks.com/topic/180402-store-image-in-mysql-and-retrive-the-image-back-to-html/#findComment-951722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.