# 413 Payload Too Large

> You tried to upload something bigger than the server accepts, and it rejected the request before reading it all.

Source: https://cwp.sg/errors/413-payload-too-large/  
Author: Ben Johnson  
Last verified: 2026-08-04

**Also seen as:** Request Entity Too Large, 413 error, upload failed file too big, exceeds the maximum upload size

## What it means

The server has a maximum request size and your upload exceeded it. It refused the whole request rather than accepting a partial file.

What makes this confusing is that **four separate limits can cause it**, and they're set in different places. Raising one and finding nothing changed means you raised the wrong one:

| Setting | What it caps |
|---|---|
| `upload_max_filesize` | The size of a single uploaded file |
| `post_max_size` | The whole POST body, including all files and form fields |
| `memory_limit` | Total memory for the request |
| Web server limit | `LimitRequestBody` in Apache, `client_max_body_size` in nginx |

The effective limit is the **smallest** of these. WordPress shows you the result on its media upload screen as "Maximum upload file size".

They also have a required ordering: `post_max_size` must exceed `upload_max_filesize`, and `memory_limit` should exceed both. Setting `upload_max_filesize` to 64M while `post_max_size` stays at 8M achieves nothing.

## Why it happens

### The file is genuinely larger than the limit

Shared hosting commonly caps uploads between 2 MB and 64 MB. Modern phone photos and any video will exceed the lower end of that easily.

### You raised one limit but not the others

The most common frustration. Raising `upload_max_filesize` alone does nothing if `post_max_size` is lower, because the whole POST body is still capped.

### Uploading several files at once

`post_max_size` covers the entire request. Ten 5 MB files in one submission is a 50 MB POST body, even though no single file is close to the per-file limit.

### A proxy in front has its own limit

Cloudflare caps upload size by plan — 100 MB on free. Your origin can accept more and the request still won't reach it.

## How to fix it

### 1. Find out what the limits actually are

Don't guess. Create a file, load it once, then **delete it**:

```php
<?php
foreach (['upload_max_filesize', 'post_max_size', 'memory_limit',
          'max_execution_time', 'max_file_uploads'] as $key) {
    printf("%-22s %s\n", $key, ini_get($key));
}
```

The smallest of the first three is your real ceiling.

### 2. Raise them together, in the right order

Create or edit `php.ini` in your web root:

```ini
upload_max_filesize = 64M
post_max_size       = 128M    ; must exceed upload_max_filesize
memory_limit        = 256M    ; should exceed post_max_size
max_execution_time  = 300     ; large uploads take time
```

Some hosts use `.user.ini` instead of `php.ini`. Changes can take a few minutes to apply because PHP caches the file.

If your host caps these above PHP, the values will silently clamp — check with the script above rather than assuming they took effect.

### 3. Try .htaccess if php.ini has no effect

```apache
<IfModule mod_php.c>
  php_value upload_max_filesize 64M
  php_value post_max_size 128M
</IfModule>
```

The `IfModule` guard matters. Without it, a server running PHP as FastCGI rather than a module treats `php_value` as an unknown directive and returns [500 Internal Server Error](/errors/500-internal-server-error/) on every page.

### 4. Upload large files over FTP instead

The upload limit applies to HTTP. FTP has no such cap.

For WordPress media, upload the files into `wp-content/uploads/YYYY/MM/` over FTP, then use a media-library-import plugin to register them. It's the standard way to move a large media library and it avoids the limit entirely.

### 5. Compress before uploading

A 12 MP phone photo is often 6 MB and looks identical at 500 KB once resized to a sensible width. If you're hitting upload limits with images, the limit probably isn't the actual problem — nobody needs a 6000-pixel-wide image on a web page.

## On CWP hosting specifically

CWP free accounts cap uploads at 10 MB per file over HTTP. FTP has no per-file limit, so large media is best uploaded that way and imported afterwards.

Raising `upload_max_filesize` past the account ceiling has no effect — the limit is enforced above PHP.

## When this means you have outgrown free hosting

Regularly needing to upload files above the plan's cap — video, large design assets, big datasets — is a real constraint that configuration cannot work around.

Worth asking whether the files should be on your web host at all. Object storage or a dedicated media service is usually cheaper and faster than hosting large files from a shared account.

---

Content Website Platform (cwp.sg) operates the free hosting it writes about; see https://cwp.sg/about/ for the methodology and the commercial disclosure.
