hi can any one plz help me out. iam trying to make a page where user can post pictures. but iam getting error and i have no idea how to fix this.
Notice: Undefined index: image in C:\xampp\htdocs\phpSTUFF\WEB\picture.php on line 15
Please select an image.
error here-line 15---->$file = $_FILES['image']['tmp_name'];
//picture.php
:php:
<html>
<body>
<form action="picture.php" method ="post" enctype="multipart/form-data">
File:
<input type="file" name = "image">
<input type="submit" value="Upload">
</form>
<?php
//connect to database
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("uploadsitestorepic") or die(mysql_error());
//file properties
$file = $_FILES['image']['tmp_name'];
if(!isset($file))
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 "Thats's not an image!";
else
{
if(!$insert = mysql_query("INSERT INTO store VALUES('', '$image_name',$image)"))
echo "Problem uploading image!";
else
{
$lastid = mysql_insert_id();
echo "Image uploaded.<p/>IMAGE:<p/><img src=get.php?id=$lastid>";
}
}
}
?>
</body>
</html>
:/php: