Common causes
- post_max_size is still at the 8M default
- upload_max_filesize was raised but post_max_size was not
- Several files uploaded in one form add up to more than the limit
- Large base64-encoded data or JSON sent in a form field
- Edits made to a php.ini that the web server does not load
How to fix it
- Compare the numbers. The first number is the request size, the second is post_max_size in bytes (8388608 = 8M). You need post_max_size above the first number.
- Raise post_max_size. In the active php.ini or .user.ini set post_max_size = 72M, and keep upload_max_filesize a bit lower, for example 64M.
- Restart PHP and verify. Restart PHP-FPM or Apache and confirm the new value in phpinfo(). Check the Loaded Configuration File line to be sure you edited the right file.
- Check server body limits. Set Nginx client_max_body_size or Apache LimitRequestBody to at least the same size, otherwise the server returns 413 instead.
- Detect the problem in code. If $_POST is empty but $_SERVER['CONTENT_LENGTH'] is greater than zero, show a clear message that the upload was too large instead of failing silently.
Detect an oversized POST in your form handler
if ($_SERVER['REQUEST_METHOD'] === 'POST'
&& empty($_POST) && empty($_FILES)
&& (int) ($_SERVER['CONTENT_LENGTH'] ?? 0) > 0) {
exit('The upload is larger than the server allows (post_max_size).');
} How to stop it happening again
- Set post_max_size and upload_max_filesize together
- Show the maximum upload size on your upload forms
- Validate file size in the browser before submitting
- Use chunked uploads for very large files