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 Quote Link to comment 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"; } Quote Link to comment 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); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.