I have a form that sends a file, yet it's not being able to be called after submit.
Form:
<form class="form-inline" action="#" id="login" method="post">
<input type="file" name="file" id="file">
<input type="hidden" name="test" value="testy">
<input class="btn btn-primary btn-block" type="submit" name="submit" value="Go">
</form>
The value of testy
comes up just fine, but nothing from _FILES after it's uploaded.
This was working when I was sending from one page to another page, but since I moved it all to happen on the same page, it's no longer working. What am I missing?
$_POST['test']
shows testy
$_FILES['file']
shows empty
You need enctype="multipart/form-data"
attribute in your form:
<form class="form-inline" action="#" id="login" method="post" enctype="multipart/form-data">
<input type="file" name="file" id="file">
<input type="hidden" name="test" value="testy">
<input class="btn btn-primary btn-block" type="submit" name="submit" value="Go">
</form>