Upload Image to MySQL using PHP
As a new-bie to php/mysql, I tried different stuffs. So here I’m with my php code for Image Upload to MySQL. Its a quite simple code with two php files one to display and one to upload.
For Image Upload code, I’ve added code download link upload-image-mysql-demo.zip at the end of the page.
CREATE TABLE `pix` (
`pic_id` int(11) NOT NULL auto_increment,
`pic_name` varchar(100) NOT NULL,
`pic_data` longblob NOT NULL,
PRIMARY KEY (`pic_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Save images to MySQL using PHP
/* Image.php*/
Show image in MySQL using PHP
/*showImage.php*/
Click here to download zip file for above demo of Uploading image to mysql using php.