File exceeds upload_max_filesize in php.ini
Raise upload_max_filesize and post_max_size in your app's PHP settings, up to 2 GB. Our front door takes requests up to 1 GB.
Updated 22 Oct 20262 min read
The whole message:
The uploaded file exceeds the upload_max_filesize directive in php.iniThe fix on Tanzahost: raise PHP's upload size for your app. Set two PHP settings, because PHP checks both: upload_max_filesize for one file, and post_max_size for the whole form, which must be at least as big.
For a deployed PHP app, like Laravel:
Open the app. Under PHP settings, set
upload_max_filesizeto64Mandpost_max_sizeto70M(a little more, for the rest of the form).Under Build and run, choose Save and build. The new version deploys without downtime.
Or put them in tanzahost.json, in your code. The dashboard's values win over the file:
{
"php": {
"ini": { "upload_max_filesize": "64M", "post_max_size": "70M" }
}
}Each can be up to 2G. For a WordPress or PHP site, see On a WordPress or PHP site below.
Why it happens
PHP throws away a file bigger than upload_max_filesize, and a whole form bigger than post_max_size. Until you change them, they're PHP's own defaults: 2 MB for a file and 8 MB for a form. The messages differ by framework:
| You see | From |
|---|---|
| The uploaded file exceeds the upload_max_filesize directive in php.ini. | PHP itself, for one file over upload_max_filesize |
413 Content Too Large, or PostTooLargeException in your logs | Laravel, for a form over post_max_size |
| (your file) exceeds the maximum upload size for this site. | WordPress |
On a WordPress or PHP site
Open the site. Under PHP settings, set Largest upload, like 64M, and save. The site restarts with it, without downtime.
Largest upload sets upload_max_filesize. A site's post_max_size stays at PHP's 8 MB for now, and the site's page can't change it yet, so a single upload over about 8 MB still fails on a site. Deployed apps can set both.
The limits outside PHP
| Where | The largest request |
|---|---|
| Our front door, in every location | 1 GB, the same for every app. It can't be changed yet. |
| Cloudflare's proxy, if your domain uses it | 100 MB on Cloudflare's Free and Pro plans, 200 MB on Business (Cloudflare's page) |
So for files over 100 MB on a domain behind Cloudflare's proxy, either switch its proxy off for that name in the DNS editor, or upload straight to a storage service from the browser. See Connect Cloudflare.
How to check
In the app's terminal, print the values PHP really uses:
php -r 'echo ini_get("upload_max_filesize"), " ", ini_get("post_max_size"), PHP_EOL;'WordPress shows the result on its upload screen as "Maximum upload file size": the smaller of the two.