This is my HTML:
<!DOCTYPE html>
<html>
    <body>
        <form action="uploaded_img.php" method="post" enctype="multipart/form- 
         data">
            Select image to upload:
            <input type="file" name="fileToUpload" id="fileToUpload">
            <input type="submit" value="Upload Image" name="submit">
        </form>
    </body>
</html>
PHP code:
<?php 
 if(isset($_POST['submit'])){
    $name = $_FILES['file']['name'];  
    $temp_name = $_FILES['file']['tmp_name'];  
    if(isset($name)){
        if(!empty($name)){      
            $location = 'uploads/';      
            if(move_uploaded_file($temp_name, $location.$name)){
                echo 'File uploaded successfully';
            }
        }       
    }  else {
        echo 'You should select a file to upload !!';
    }
}
?>
My code is giving me these errors:
Notice: Undefined index: file in C:\xampp\htdocs\phptutorial\uploaded_img.php on line 3 Notice: Undefined index: file in C:\xampp\htdocs\phptutorial\uploaded_img.php on line 4 You should select a file to upload !!
i want to save the upload image in c:xamp\htdocs\phptutorials\uploads
 
     
     
    