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).
If you enjoyed this post, make sure you subscribe to my RSS feed!
Hi, I'm Alan Beam. I'm a 25 year old web developer enjoying life in Plano, Texas. I created SixTwenty to share solutions to common issues in a variety of programming languages. If you like what I have to offer, you can