Upload image into the database and retrieve from it See this in video: Image upload Create the database name as 'image' and just copy this table given below Database CREATE TABLE IF NOT EXISTS `upload` ( `id` int(255) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `image` longblob NOT NULL, PRIMARY KEY (`id`) ) Html: PHP: (upload and display) mysql_connect("localhost","root",""); mysql_select_db("image"); if(isset($_POST["submit"])){ $filename = addslashes($_FILES['img']['name']); $tmpname = addslashes(file_get_contents($_FILES['img']['tmp_name'])); $filetype = addslashes($_FILES['img']['type']); $filesize = addslashes($_FILES['img']['size']); $array = array('jpg','jpeg'); $ext = pathinfo($filename, PATHINFO_EXTENSION); if(!empty($filename)){ if(in_array($ext, $array)){ mysql_query("Insert into ...
Comments
Post a Comment