I am trying to upload a image but i am unable to do it. Whenever i upload a image it says an undefined index. It says 'photo' is an undefined index. here is my form code.
<input type="file" name="photo" id="photo" required>
and my php code
    if (isset($_POST['save'])) {
    $photo = $_FILES['photo']['tmp_name']; //error occured on this line
    $add_photo = "insert into photo values(NULL, 1, '$photo')";
    $res1 = querySelect($add_photo);
    $target = "../../images/".basename($_FILES['photo']['tmp_name']);
    echo $target;
    if (!move_uploaded_file($_FILES['photo']['tmp_name'], $target)) {
        error_reporting(E_ALL);
    } else {
        echo "Successfull";
    };
    //header("location: ../view/home.php");
}
All the field is inserted to the database but the only the problem is photo doesn't move to the given directory.
And sorry for poor english
 
    