So I have this code:
<form name="form" action="./" method="post">
<input type="file" name="newfile" id="newfile" />
</form>
When I run this php script on the action page, nothing happens
echo "$_FILES['newfile']['name'];
print_r($_FILES);
It is like the $_FILES variable is empty. Is there any way to fix this?
You need to set the
enctype="multipart/form-data"attribute on your form.Example 1 from php.net: