<html> <body> <form action="uploading.php" method="post" enctype="multipart/form-data"> <table width="350" border="0" cellpadding="1" cellspacing="1" class="box"> <tr> <td width="246"> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"> <input name="userfile" type="file" id="userfile"> </td> <td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td> </tr> </table> </form> </body> </html> <?php if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) $con=mysql_connect("localhost" ,"root" ,""); mysql_select_db("rafi"); { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; if(!get_magic_quotes_gpc()) { $fileName = addslashes(file_get_contents($userfile)); } $query = "INSERT INTO upload (name, size, type, content ) "."VALUES ('$fileName', '$fileSize', '$fileType', '$content')"; mysql_query($query) mysql_close($con); $query=("Select * FROM upload"); $blah=mysql_query($query) while(list(*)=mysql_fetch_array($blah)) echo "FileName"; ?> THe image is not displaying plz help me !
You forget to move the image to some defined location as well as store the path into the database. Normally, I would use defined my path, then try to move my file over that path. If the file exist, give errors. Otherwise, use function move_uploaded_file and then store the path into database.
check where your script is uploading the images, make sure that you display the right path. and thats it
You have not moved the images from temp to some physical location of your server. You can use move_uploaded_file php function to move the image to a defined location.and keep that path in DB.
You can try look the error message on your apache error.log or you can add : error_reporting(E_ALL); Code (markup): to show the error that occured