When trying to access the $_FILES
array, PHP returns the error
"Undefined index: picture".
In my php.ini
file, File Uploads
are turned on, and any user can write in the /tmp
directory. In the HTML form, enctype is set to "multipart/form-data"
. Interestingly enough, the basename for the uploaded file prints so I believe that PHP has actually seen the file, but has some problem uploading it.
Can someone provides suggestions on potential solutions to this problem? By the way, I am using PHP5.
Snippets from PHP File
echo "Picture=" . $_POST['picture'] . "<br/>";
$uploadedPic = $_FILES['picture']['tmp_name'];
HTML Form
<form action="PHPFile.php" method="post" enctype="multipart/form-data">
<p> Picture </p>
<input type = "file" id="picture" name="picture"/>
</form>
On what line do you get that warning? If it is the one with $_POST['picture']
, then its logical, you wont find uploaded file data in $_POST
, it is in $_FILES
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With