I am trying to upload a text file using html form. after I submit, I don't get file path in php.
I tried $_FILES['file']['name'];
, $_FILES['file']['tmp_name'];
, also tried to echo $_POST['file'];
It shows only file name.
<form class="form-inline" method="post" action="getfile.php">
<div class="mb-2 mr-sm-2 mb-sm-0 position-relative form-group">
<input name="file" type="file" class="">
</div>
<button class="btn btn-primary">Submit</button>
</form>
this is my PHP file
getfile.php
<?php
if (isset($_POST['file'])) {
$name_file = $_FILES['file']['name'];
$tmp_name = $_FILES['file']['tmp_name'];
$local_file = "uploaded/".$name_file;
move_uploaded_file($tmp_name,$local_file);
}
?>
in this case echo $_POST['file']; shows only file name but the file is not moved to the folder