Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$_FILES Empty When Uploading

Tags:

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>
like image 774
Paradius Avatar asked Aug 28 '09 10:08

Paradius


1 Answers

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

like image 99
Anti Veeranna Avatar answered Sep 20 '22 02:09

Anti Veeranna