Troubleshooting
WordPress an Error Occurred in the Upload: Causes and How to Fix It

Short answer
This generic WordPress message appears when the server rejects an upload without a clear reason. Common causes are a file over the server size limit, a firewall blocking the REST API, an expired login session or low PHP memory. Check the failed request in your browser's Network tab to see the real error.
Key takeaways
- The message is generic, so find the real status code in the browser Network tab.
- Web server and CDN size limits often reject large files before WordPress can explain.
- Block editor uploads use the REST API, which firewalls and security plugins may block.
- Reload the editor if it has been open for hours, since tokens expire.
- Low PHP memory, full disks and wrong folder permissions also break uploads.
What does the WordPress upload error message mean?
It means WordPress sent your file to the server but got back an error or an unreadable reply, so it shows a generic message instead of a specific reason.
The full message usually reads An error occurred in the upload. Please try again later. It often appears when you drag an image into the block editor or upload through a block such as Image or Cover.
The message is vague on purpose. WordPress shows it when the server's reply does not explain what went wrong. That could be a size limit, a timeout, a firewall block, an expired login or a PHP error.
So the fix is to find the real error behind it. The sections below go from the most common causes to the rarer ones.
This message is close to, but not the same as, the HTTP error shown in the Media Library. If you see that one instead, read our guide to fixing the HTTP error when uploading images.
Is the file too large for your server?
A file larger than your server's upload or post size limit is the most common cause, especially when a web server limit rejects it before WordPress can explain why.
There are several limits, and any one of them can block the file:
- upload_max_filesize in PHP.
- post_max_size in PHP, which must be larger than the upload limit.
- client_max_body_size in Nginx.
- Proxy or CDN limits, such as Cloudflare's request size limit on its plans.
When PHP blocks a large file, WordPress normally shows a clear size message. When Nginx or a proxy blocks it, the server returns a 413 Content Too Large response. WordPress cannot read that, so you get the generic error.
Check your limit under Media > Add New Media File, where WordPress shows the maximum upload size. Try a smaller copy of the file. If that works, raise the limit with our guide on increasing the max upload size.
The PHP settings are described in the PHP core ini documentation. The Nginx setting is in the Nginx core module docs.
Is the REST API being blocked?
The block editor uploads files through the WordPress REST API, so a security plugin or firewall that blocks it will cause this error in the editor.
This explains a common pattern. Uploads work fine in Media > Add New, which uses an older upload method, but fail inside the block editor.
Check these places:
- Security plugins that disable or restrict the REST API.
- Firewall rules at your host, such as ModSecurity.
- Cloudflare WAF rules that challenge or block POST requests to the media endpoint.
Go to Tools > Site Health. If it reports that the REST API returned an unexpected result, that is a strong clue. The REST API handbook explains how the media endpoint works.
If you use Cloudflare, review blocked events in its security log. Our guide to Cloudflare WAF rules for WordPress shows how to add an exception.
Has your login session expired?
If you left the editor open for hours, your login or security token may have expired, and WordPress rejects the upload as unauthorized.
WordPress uses short-lived security tokens called nonces for uploads. When they expire, the request fails.
Save your draft, reload the editor and try again. If you get logged out often, check whether a caching plugin is caching admin pages or whether your site address settings mix www and non-www versions.
Is the server running out of memory or time?
Large images need memory to create thumbnails, and if PHP runs out of memory or time mid-upload, the server returns an error WordPress cannot read.
This is common on cheap shared hosting with high-resolution photos from modern phones. WordPress creates several resized copies of each image, and each one uses memory.
Try these fixes:
- Resize the image to a sensible width before uploading.
- Raise the PHP memory limit. Our guide on increasing the PHP memory limit shows how.
- Ask your host to raise the PHP execution time.
- Check the error log for Allowed memory size exhausted messages.
If you find memory errors in the log, our guide to fixing allowed memory size exhausted covers the deeper causes.
Are folder permissions or disk space the problem?
If WordPress cannot write to the uploads folder or the account is out of disk space, uploads fail, sometimes with this generic message.
WordPress stores uploads in wp-content/uploads, sorted into year and month folders. The web server must be able to create those folders and write files into them.
Check:
- Permissions. Folders are usually 755 and files 644. See our guide to setting correct file permissions.
- Ownership. The files should belong to the user the web server runs as.
- Disk quota. Look at your hosting panel's disk usage. A full account blocks all uploads.
- Upload path. Under Settings > Media, an old custom upload path from a previous host can break uploads after a move.
How do you find the real error behind the message?
Open your browser's developer tools, retry the upload, and look at the failed request's status code and response in the Network tab.
This is the quickest way to stop guessing. Do this:
- Open the editor and press F12 to open developer tools.
- Click the Network tab.
- Upload the file again.
- Find the failed request, usually to media or async-upload.php.
- Check its status code and response text.
Then match the code:
| Status code | What it usually means | Where to look |
|---|---|---|
| 413 | File too large for web server or proxy | Nginx, CDN or host limits |
| 403 | Blocked by firewall or permissions | Security plugin, ModSecurity, WAF |
| 401 | Login or token expired | Reload the editor and log in again |
| 500 | PHP error on the server | PHP error log, debug log |
| 502 or 504 | Server timed out | PHP time limits, hosting resources |
For a 500 error, turn on logging and check the details. Our guide on reading the WordPress debug log explains what to look for.
Could a plugin or theme be causing it?
Yes, image optimization, security and media plugins often hook into uploads, and a bug in any of them can make the upload fail.
Image compressors that process files on upload are frequent suspects. So are plugins that rename files or offload media to cloud storage.
Temporarily deactivate those plugins and retry the upload.
If it works, turn them back on one at a time. Our guide to fixing a plugin conflict gives a safe method. Test on staging if your site is busy.
What should you try first?
Start with a smaller file, a reloaded editor and the Media Library uploader, because those three tests split the possible causes quickly.
- If a small file works, the problem is size or memory.
- If the Media Library works but the editor fails, the REST API is blocked.
- If reloading fixes it, your session had expired.
- If nothing works, check permissions, disk space and the server error log.
When you need your host's help, send them the status code and the time of the failed upload. That lets their support team find the matching line in the server logs.
Frequently asked questions
Why do uploads work in the Media Library but not in the block editor?
The block editor uploads files through the REST API, while the Media Library uploader uses a different route. If a security plugin, host firewall or CDN rule blocks REST API requests, uploads fail only in the editor. Check Site Health and your firewall logs.
Is this the same as the HTTP error in WordPress?
They are related but not identical. Both are vague messages that hide a server-side problem. The HTTP error usually shows in the Media Library during image processing, while this message is more common when uploading from the block editor.
Can a file name cause this upload error?
Rarely, but some firewalls block file names with unusual characters, very long names or words that look like code. Rename the file using plain letters, numbers and dashes, then try the upload again.
Does Cloudflare limit upload size?
Yes. Cloudflare limits the size of requests it passes to your server, and the limit depends on your plan. Files larger than that are rejected before they reach WordPress. Check Cloudflare's current limits for your plan or upload large files another way.
What should I send my host if I cannot fix it?
Send the exact time of the failed upload, the status code from the browser Network tab, the file size and type, and whether it fails in the Media Library too. That helps support find the matching entry in the server logs quickly.
Sources
- 413 Content Too Large MDN Web Docs
- Core php.ini directives PHP Manual
- client_max_body_size Nginx
- REST API Handbook WordPress Developer Resources
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


