Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange PHP error, where does it come from? Codeigniter

Today i was making a file upload for avatars, everything works great, it resizes the images etc, but occasionally when selecting a large and invalid file it produces this error :

Warning: POST Content-Length of 52091839 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
You did not select a file to upload.

This does not happen all the time, just occasionally. Normally it just gives the correct error message when a file is too big.

Does anyone have an idea where this error comes from, and why it shows?

Thanks!

like image 598
user1362916 Avatar asked Apr 25 '26 08:04

user1362916


2 Answers

Sounds like you need to increase post_max_size in php.ini. If you have not already also increased upload_max_filesize, you are likely to need to increase it as well.

# php.ini
# Allow huge files:
# Post usually needs to be bigger than file upload size!
post_max_size = 256M
upload_max_filesize 128M
like image 69
Michael Berkowski Avatar answered Apr 26 '26 20:04

Michael Berkowski


Update your post_max_size in php.ini to a larger value

upload_max_filesize sets the max file size that a user can upload while post_max_size sets the maximum amount of data that can be sent via a POST in a form. That might be the reason why you get big file error sometimes when you try upload a single file of large size but when you try to upload multiple files the above error is raised.

like image 41
Srijan Avatar answered Apr 26 '26 20:04

Srijan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!