Are you trying to implement an image or video uploader in your PHP project, specifically a Laravel 4+ project, and you find that the upload HTTP POST is indeed hitting your controller method but Input::all(), Input::file(‘files’), and $_FILES are all empty arrays? Well there is a really good chance its not your front-end nor your back-end code that is the problem, its most likely its PHP playing a cruel trick on you. According to the PHP documentation, if the php.ini default settings are in play, PHP is restricting file uploads that are bigger than the default size of 8 megabytes.
Yes that is correct, in today’s modern world of web development and today’s internet of media, the makers of PHP have decided that file uploads should still be restricted to a file size more appropriate for the late 1990’s. But on top of that, instead of providing a warning message in the HTTP Request object that the limit is being exceeded, PHP just simply removes the request objects all together and pretends nothing was submitted with the request at all, leaving the developer in a complete state of profound confusion.
That being said, go change your defaults (CentOS specific):
nano /etc/php.ini
Search for each of these default keys and set the values you feel best fit your needs:
memory_limit = 4000M
upload_max_filesize = 1000M
post_max_size = 1500M
Restart the Apache service:
service httpd restart
Published by