Upload error: File too large (LIMIT_FILE_SIZE / file exceeds maximum upload size)
The uploaded file is larger than the limit set by the API, framework or server.
Seen on:
REST API
Meaning
Limits exist at several layers: the app (Multer LIMIT_FILE_SIZE “File too large”, Laravel “may not be greater than 2048 kilobytes”), the language runtime (PHP upload_max_filesize / post_max_size), the web server (Nginx client_max_body_size → 413) and the provider (S3 single PUT 5 GB, many APIs 10–100 MB).
The smallest limit wins, so raising one layer isn’t enough if another is lower.
Common causes
- File genuinely above the documented limit
- Framework limit lower than the server limit (or vice versa)
- Multipart overhead or base64 encoding (+33%) pushes it over
- Proxy/CDN limit in front of the app
⚡ Quick fix
- Compress or resize before uploading
- Use the provider’s multipart/chunked or resumable upload for large files
- Raise the limit at every layer you control (app, PHP, web server, proxy)
Detailed fix by platform
Node.js
const upload = multer({ limits: { fileSize: 20 * 1024 * 1024 } }); // 20 MB
PHP
- php
; php.ini upload_max_filesize = 20M post_max_size = 25M
Nginx
client_max_body_size 25m;
How to diagnose
- Size — Actual file and request size
- Layers — App, runtime, web server, proxy limits
- Encoding — Is the file base64-encoded in JSON?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026