Multiple image upload to database and display from it
Upload image into the database and retrieve from it
Video: Multiple image upload and display from database
Create the database name as 'image' and just copy this table given below
Database
CREATE TABLE IF NOT EXISTS `multiple` (
`id` int(255) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`image` longblob NOT NULL,
PRIMARY KEY (`id`)
)
Html: In this form tag make sure that you set the '[ ]' in the input tag and 'multiple' use to select the multiple image
PHP: (upload and display)
mysql_connect("localhost","root",""); mysql_select_dB("image"); if(isset($_POST["submit"])){ $filename = $_FILES['img']['name'];
$file_tmp = $_FILES['img']['tmp_name'];
$filetype = $_FILES['img']['type'];
$filesize = $_FILES['img']['size'];
for($i=0; $i<=count($file_tmp); $i++){
if(!empty($file_tmp[$i])){
$name = addslashes($filename[$i]);
$temp = addslashes(file_get_contents($file_tmp[$i]));
if(mysql_query("Insert into multiple(name,image) values('$name','$temp')")){
}
else{
echo "failed";
echo "
"; } } } } $res = mysql_query("SELECT * FROM multiple"); while($row = mysql_fetch_array($res)){ $displ = $row['image']; // please place the single quotation ' instead ' echo ''; echo "
"; }
Video: Multiple image upload and display from database
Create the database name as 'image' and just copy this table given below
Database
Html: In this form tag make sure that you set the '[ ]' in the input tag and 'multiple' use to select the multiple image
PHP: (upload and display)
"; } } } } $res = mysql_query("SELECT * FROM multiple"); while($row = mysql_fetch_array($res)){ $displ = $row['image']; // please place the single quotation ' instead ' echo ''; echo "
"; }
Thanks for Sharing an Information to us . If Someone wants to know about Digital Marketing Course and Web Development Courses. I think this is the right place for you.
ReplyDeleteSEO Courses in coimbatore and Digital Marketing Courses in Coimbatore
Thanks very much sir
ReplyDeletehi thank you for your code.. but i got this error mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\web\imageview.php on line 33
ReplyDelete