Search code examples
phpajaxfile-uploadlaravel-3

Laravel + AJAX file upload fails due to file size


Uploading files larger than around 100KB fails with 500 server error. The site is built on Laravel and is using AJAX for file uploading. Small files can be loaded without problems.

I have tested uploading with the same image that is scaled with GIMP to smaller than 100KB and another one which is scaled bigger than 100KB, so the problem cannot be file type or anything related to image itself instead the problem seems to be related only to file size.

I have checked php.ini for max memory, upload_max_filesize, post_max_size and all are fine. I have also checked that apache virtualhost is not having max file size configuration. I have checked apache logs and it shows only 500 server error without anymore details. I cannot find any clue in any other log file. I have debugged the jQuery to AJAX call and ensured that the called function on PHP side is not being called. I have tried to check Laravel configurations, but couldn't find anything that could be related.

Any ideas where the file size limit could be coming from? Or any ideas where to get more information where the 500 is coming from?


Solution

  • The reason was apache mod_fcgid which was limiting file upload size to 128KB by default.