i have this error when i am trying to upload a picture to the database and this is the code :
<?php
include('connection.php');
if(isset($_POST['button'])){
$file = $_FILES['file']['name'];
$file_tmp = $_FILES['file']['tmp_name'];
$random_name = rand();
if(empty($file)){
echo "Please choose a picture <br/><br/>";
} else {
move_uploaded_file($file_tmp, '../profilepics/'.$random_name.'.jpg');
mysql_query("INSERT INTO userphoto VALUES ('$random_name.jpg')");
header('location: timeline.php');
}
}
?>
and then its says :
Notice: Undefined index: file in C:\xampp\htdocs\Echo\php\userphotoupload.php on line 6
Notice: Undefined index: file in C:\xampp\htdocs\Echo\php\userphotoupload.php on line 7