File upload failing

Updated 11 October 2026

Short answer

When small files upload but bigger ones fail, a size limit is in the way, and there are usually several stacked up. The web server has one (Nginx answers "413 Request Entity Too Large" when it's exceeded), PHP has two (upload_max_filesize, which defaults to 2 MB, and post_max_size, which must be larger), and your app or CMS may have its own. Raise all of them together. If no size works, look at permissions or disk space instead.

What's the problem

Uploads fail with "413 Request Entity Too Large", "The uploaded file exceeds the upload_max_filesize directive in php.ini", a generic error, or they just stop partway, especially for larger files.

Why it happens

  • Size limits: web server, PHP, app, or a proxy or CDN in front.
  • Timeouts on slow connections for large files.
  • Folder permissions stopping the server writing the file.
  • Disk full. See disk full.
  • File type rules rejecting the format.
  • Security rules flagging the upload.

How to fix it

  1. Read the exact error and note the file size that fails.
  2. Raise the web server limit (for Nginx, client_max_body_size).
  3. Raise PHP's limits if you use PHP: upload_max_filesize, and post_max_size larger than it.
  4. Check your app or CMS for its own maximum.
  5. Check folder permissions and free disk space.
  6. For very large files, upload in chunks or directly to cloud storage.

What Preventionlabs checks

One click runs the full report on your domain. For this problem it shows whether your site loads, how fast, and where its redirects go; up to 50 pages from your sitemap, listing any that fail or are slow, plus broken links on them. With Cloudflare connected, it also shows which pages returned server errors (5xx) to visitors, and when; which requests the firewall blocked, by Cloudflare's own rule names; recent deploys and account changes, with their times. It doesn't fill in forms, log in or make payments, so test the feature yourself as well.

Run your free report

Your first report is free, no card needed. Then A$50 a month, up to 10 domains. Read-only: it never changes anything.

Sources

  1. nginx: Module ngx_http_core_moduleofficial docsSets the maximum allowed size of the client request body. If the size in a request exceeds the configured value, the 413 (Request Entity Too Large) error is returned to the client.
  2. PHP: Description of core php.ini directivesofficial docsupload_max_filesize "2M" INI_PERDIR
  3. PHP: Description of core php.ini directivesofficial docsSets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize .
  4. PHP: Error Messages Explainedofficial docsThe uploaded file exceeds the upload_max_filesize directive in php.ini
← All of Broken features