This question already has an answer here:
<?php
$name= $_FILES['fname']['name'];
echo $name;
?>
<form action="test.php" method="POST" enctype=" multipart/form-data">
Select file: <br><br>
<input type="file" name="fname"><br><br>
<input type="submit"><br>
</form>
</div>