MattB's avatar
Level 2

Increase File Upload Size

How do I increase the file upload in Laravel? I saw somewhere about editing the php.ini but a: I can't find it in my laravel project and b: some confusion about the code to use. Can you help, please?

0 likes
4 replies
ftiersch's avatar

You don't have to increase it in Laravel, you have to increase it in PHP. In your php.ini there is a value that sets the maximum filesize PHP will accept.

You have to talk to your hoster (if you don't manage your webserver yourself) that you need bigger filesizes. Laravel won't limit the filesize itself (if you don't make it with a validation for example).

Cronix's avatar

How did you install php? That's where the php.ini would be, not in laravel. Laravel doesn't have anything to do with your php installation or settings. It only uses them.

You would have to set these 2 settings in the php.ini, wherever it is installed on your system, and then restart your webserver so the changes will take effect. If you don't know where it's installed, perhaps you could just search/scan the drive for it using whatever operating system you're using.

upload_max_filesize = 20M
post_max_size = 21M

post_max_size should be bigger than upload_max_filesize, as that is for all fields submitted in the request, not just the uploaded file.

MattB's avatar
Level 2

Ok but when I log in to cPanel and then file manager, I don't seem to be able to see the php.ini file when I search. Should it be in file manager or elsewhere?

Please or to participate in this conversation.