I'm trying to get a file uploaded through a PHP script, but my $_FILES array is always empty? My $_POST data entry for the file HTML input element has the filename...Just no file is created on my local system.
I've verified write access to the temp folder and explicity set it. I've checked phpinfo() to make sure file uploads are enabled, and they are.
What could be preventing this? Would mod_rewrite cause anything?
Thanks!
Are you defining the enctype in your form ?
No file will be uploaded if you don't set it.
When you have the proper enctype(
<form method="post" enctype="multipart/form-data">
), then check the errno variable in $_FILES, there are various possible causes for a failure. Typical is MAX_FILE_SIZE being exceeded.http://php.net/manual/en/features.file-upload.errors.php
Does the form have the right enctype?