I can change max file upload size in php.ini in my local but unable to do the same in Laravel 5.4. I want to upload 4mb csv file.
问题:
回答1:
You need to configure both your webserver and PHP to allow larger file uploads. For PHP you'll want to configure upload_max_filesize and post_max_size to the size you. E.g.:
upload_max_filesize = 5M
post_max_size = 8M
For NGINX you'll want to configure client_max_body_size, and for Apache you'll want to configure LimitRequestBody.
There are also several other configuration options in your webserver config which could prevent the upload of larger files. Please see the manual of your webserver for how to configure those values correctly.
Note that after configuring these settings you'll want to restart both PHP and your webserver.
回答2:
Thanks people for helping me out. I know the php.ini file exists in PHP/Apache. If I edit that to increase the upload size, it works in my local. But my aim was to upload it in my laravel website.
After too many hit and trials, I finally found the solution you have to edit public/.htaccess Add this
RewriteEngine On php_value upload_max_filesize 10M php_value post_max_size 20M php_value memory_limit 32M
This will increase the file upload size in Laravel 5.4
I recently started using laravel and upgraded to 5.4 as soon as it released. So, I had many questions.