PHP File Upload Gives Empty $_POST and $_FILES

10 minutes ago, I was banging my head against the wall. I could not, for the life of me, upload a file bigger than about 7MB. I increased the MAX_FILE_SIZE hidden field and the UPLOAD_MAX_FILESIZE in my php.ini file to 100MB, just to be safe. Still nothing.

Google to the rescue. One of the results came from a comment on PHP.net’s Error Messages Explained page. And I quote:

if post is greater than post_max_size set in php.ini
$_FILES and $_POST will return empty

Something I didn’t know to look for was the POST_MAX_SIZE setting. I increased this to 100MB and it worked like a charm.

* As a side note, in most instances, I would not recommend using 100MB as your max file size and post size. After getting it to work, I decreased it to a more reasonable amount (20MB).

Bookmark and Share
If you enjoyed this post, make sure you subscribe to my RSS feed!

Filed under PHP · Tagged with , ,

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!