Search the Community
Showing results for tags 'image browse & upload'.
-
Hi, Below is my image browse upload code , here I can insert image in database, but it is dispaly only icon instead of image, Please help me to display image...many many thanks in advance index.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Logo Upload here..</title> </head> <body> <form action="index.php" method="post" enctype="multipart/form-data"> <label>Product Name</label> <input type="text" name="pname" /> <label>Product image</label> <input type="file" name="image" > <input type="submit" name="submit" value="Add Logo"> </form> <?php include "db_conexn.php"; if(!isset($_FILES["image"]["tmp_name"])) echo "Please select an image.."; else { $image=addslashes(file_get_contents($_FILES["image"]["tmp_name"])); $image_name=addslashes($_FILES["image"]["name"]); $image_size=getimagesize($_FILES["image"]["tmp_name"]); if($image_size==FALSE) echo "It is not an image"; else { $insert=mysql_query("insert into images values('','$image_name','$image')"); echo "<img src='uploadsql.php'>"; } } ?> </body> </html> uploadsql.php <html> <body> <?php $result=mysql_query("select * from images"); while($row=mysql_fetch_array($result)) { header("Content-Type:image/jpeg"); $image=$row['image']; echo $image; } ?> </html> table table : images id name image 26 Chrysanthemum.jpg [bLOB - 858.8 KiB]