i am building a script using php to upload images in database but i am stuck due to the error under: when i open my page in browser following message shows to me:
Notice: Undefined index: image in C:\xampp\htdocs\12\index.php on line 10 please select a file
under is my script in initial form :
<html>
<body>
<form action="index.php" method="post" enctype="multipart/form-data">
File:<input type="file" name="image" /><input type="submit" value="upload" />
</form>
<?php
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("databaseimage") or die(mysql_error());
//files properties
echo $file = $_FILES["image"]["tmp_name"];
if(!isset($file))
echo'please select a file';
else{
$image = $_FILES['image']['tmp_name'];
}
?>
</body>
</html>
mysql_*functions in new code. They are no longer maintained and the deprecation process has begun on it. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.