<!DOCTYPE html>
<html>
<body>

<form action="" method="post" enctype="multipart/form-data">
  Select image to upload:
  <input type="file" name="file" id="file">
  <input type="submit" value="Upload Image" name="submit">
</form>

</body>
</html>

<?php

if(isset($_POST["submit"])) {
    $uploadedFile = $_FILES['file']['tmp_name'];
    $destination = "uploads/".$_FILES['file']['name'];
    
    if(file_exists($uploadedFile))
    {
        if(move_uploaded_file($uploadedFile, $destination))
        {
            echo "upload complete";
        }else
        {
           echo "move_uploaded_file failed";
           exit();
        }
    }
    else
    {
       echo "file upload failed";
       exit();
    } 
}

?>