HTTP Multipart Upload Errors — File Upload Failures and Size Limits
About HTTP Multipart Upload Errors
Fix HTTP multipart file upload errors including 413 Payload Too Large, boundary parsing failures, timeout errors, and server-side size limit configuration. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.
Here are the key things to understand: Multipart/form-data is the standard Content-Type for file uploads in HTML forms and APIs. Each part is separated by a boundary string defined in the Content-Type header. Server rejects uploads exceeding the configured maximum size with 413 Payload Too Large. Large file uploads can timeout if the server or proxy connection timeout is too short. Chunked transfer encoding can be used for unknown-size uploads but is not universally supported. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.
The most common reasons this occurs include: File exceeds server's maximum upload size (client_max_body_size in Nginx, LimitRequestBody in Apache). Missing or incorrect Content-Type: multipart/form-data boundary in the request. Connection timeout during large file upload over slow network. Proxy or CDN imposing a lower size limit than the backend server. Server running out of disk space or temp directory during upload processing. Identifying the root cause is the first step toward finding the right solution.
To resolve this, follow these recommended steps: Check the maximum upload size: Nginx default is 1MB (set client_max_body_size), PHP default is 2MB (upload_max_filesize). Increase Nginx: client_max_body_size 100m; and proxy_read_timeout 300s for large uploads. For PHP: set upload_max_filesize and post_max_size in php.ini. Implement chunked upload for large files: split into parts, upload each, reassemble on server. Increase proxy timeout settings: proxy_read_timeout, proxy_send_timeout for large file transfers. Monitor server disk space and temp directory permissions. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.
This article is part of our HTTP Status Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.
Quick Answer
What is the default maximum upload size?
It varies: Nginx defaults to 1MB, Apache has no default limit, PHP defaults to 2MB, Node.js Express defaults to 100KB for JSON. Always check all layers in your stack.
Overview
Fix HTTP multipart file upload errors including 413 Payload Too Large, boundary parsing failures, timeout errors, and server-side size limit configuration.
Key Details
- Multipart/form-data is the standard Content-Type for file uploads in HTML forms and APIs
- Each part is separated by a boundary string defined in the Content-Type header
- Server rejects uploads exceeding the configured maximum size with 413 Payload Too Large
- Large file uploads can timeout if the server or proxy connection timeout is too short
- Chunked transfer encoding can be used for unknown-size uploads but is not universally supported
Common Causes
- File exceeds server's maximum upload size (client_max_body_size in Nginx, LimitRequestBody in Apache)
- Missing or incorrect Content-Type: multipart/form-data boundary in the request
- Connection timeout during large file upload over slow network
- Proxy or CDN imposing a lower size limit than the backend server
- Server running out of disk space or temp directory during upload processing
Steps
- 1Check the maximum upload size: Nginx default is 1MB (set client_max_body_size), PHP default is 2MB (upload_max_filesize)
- 2Increase Nginx: client_max_body_size 100m; and proxy_read_timeout 300s for large uploads
- 3For PHP: set upload_max_filesize and post_max_size in php.ini
- 4Implement chunked upload for large files: split into parts, upload each, reassemble on server
- 5Increase proxy timeout settings: proxy_read_timeout, proxy_send_timeout for large file transfers
- 6Monitor server disk space and temp directory permissions