WordPress HTTP Error on Media Upload: The Seven Real Causes
Read the status code in the Network tab, then match it to one of seven causes: limits, image editor, scaling, timeouts, permissions, firewall or conflicts.

An “HTTP error” on a media upload means the browser sent the file and got back something it could not use: a PHP crash, a timeout, a block page from a firewall, or a size rejection. The fastest way to find the cause is to open the browser’s Network tab, retry the upload and read the status code of the upload request. A 413 points to a size limit, a 403 to a firewall or permissions rule, a 500 to a PHP crash (often memory or the image library), and a 502 or 504 to a timeout. This guide covers the seven causes behind almost every case, with the symptom, the check and the fix for each. We checked every setting, filter and constant below against WordPress core source and official documentation on 15 November 2026.
What does the HTTP error on media upload actually mean?
It is a generic failure message, not a WordPress error code. Two details matter before you change any setting.
First, the literal text “HTTP error.” belongs to old versions. Until WordPress 5.2 the Media Library uploader showed exactly that. From WordPress 5.3 core replaced it with “Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.” For image post-processing failures it shows “The server cannot process the image. This can happen if the server is busy or does not have enough resources to complete the task. Uploading a smaller image may help. Suggested maximum size is 2560 pixels.” If you still see the two-word version, it usually comes from a page builder, a plugin’s own uploader or the uploader library’s default text, and the same diagnosis applies.
Second, the message says the file “may have been uploaded successfully,” and that is literal. A failure during thumbnail generation can leave the original file and an attachment record on the server. Check the Media Library before you retry, or you will end up with duplicates.
The block editor uses a different path. It posts the file to /wp-json/wp/v2/media and expects JSON back. When the response is a PHP fatal error, a proxy error page or a truncated body, the editor’s API client reports an invalid_json error, which people see as “The response is not a valid JSON response.” A Gutenberg change merged in August 2026 (pull request 81735) makes newer editor builds say “Failed to upload” with the file name instead of passing that code on. Different wording, same meaning: the server failed to answer properly.
How do I find which of the seven causes it is?
Do this before touching a config file. It takes about five minutes and rules out most of the list.
- Read the status code. Open the browser developer tools, go to the Network tab, retry the upload and click the failed request (
async-upload.phpin the Media Library,wp/v2/mediain the block editor). The table below maps what you see to the likely cause. - Try a 50 KB image. If it uploads and a 6 MB photo does not, the problem scales with size: limits, memory, timeouts or the scaling step. If the tiny image fails too, look at permissions, the firewall, a plugin or the image library itself.
- Try a PDF. A PDF does not go through the image editor. If the PDF works and every image fails, suspect the image library.
- Try a second administrator account and a second browser. One account failing points to roles or a security rule. One browser failing points to extensions or cached scripts.
- Open Tools, Site Health, Info. The Server and Media Handling sections list the PHP limits and image library details that WordPress itself sees on the web request.
What the Network tab shows | Most likely cause | Go to |
|---|---|---|
413 Request Entity Too Large | A size limit in PHP, nginx, ModSecurity or a CDN | Causes 1 and 6 |
403 Forbidden, often an HTML page | Firewall rule or a security plugin | Cause 6 |
500 Internal Server Error | PHP ran out of memory or crashed in the image library, or a server module rejected the body | Causes 1, 2, 3 |
502 or 504, or a long wait then failure | A timeout somewhere between browser and PHP | Cause 4 |
200 but the response is HTML, not JSON | A plugin or theme printed output into the response | Cause 7 |
Request never appears, or fails with a network error | Browser, extension, connection or proxy dropped it | Cause 7 |
Cause 1: why do uploads fail when upload_max_filesize, post_max_size or memory_limit are too low?
Symptom. Large files fail, small ones work, and the failure is repeatable at roughly the same size. Sometimes the Media Library prints “exceeds the maximum upload size for this site,” but when the request body is rejected before WordPress runs, you only get the generic error.
How the limits relate. The PHP manual states that post_max_size must be larger than upload_max_filesize, and that memory_limit should generally be larger than post_max_size. WordPress shows the lower of the first two as the maximum upload size, through wp_max_upload_size() and its upload_size_limit filter. If the POST body exceeds post_max_size, PHP leaves $_POST and $_FILES empty without raising an error, which is why this failure can look silent.
Stock PHP defaults are small: 2M for upload_max_filesize, 8M for post_max_size, 20 for max_file_uploads and 128M for memory_limit. Many hosts raise them, so read what your site actually runs with.
Check. Open Tools, Site Health, Info, Media Handling. It lists “Max size of post data allowed,” “Max size of an uploaded file,” “Max effective file size” and “Max simultaneous file uploads,” read from the web request. Do not trust wp eval or php -i for this: command-line PHP often loads a different php.ini than the web server does, so the numbers can disagree with what uploads actually get.
Fix. upload_max_filesize and post_max_size cannot be set with ini_set(). Set them in php.ini, a .user.ini file in the site root (common on shared hosting and PHP-FPM), the PHP pool configuration, or your host’s PHP settings screen. Keep the order:
; php.ini or .user.ini (checked on 15 Nov 2026)
upload_max_filesize = 64M
post_max_size = 72M ; larger than upload_max_filesize
memory_limit = 256M ; larger than post_max_sizePHP re-reads .user.ini files on a cache interval, 300 seconds by default (user_ini.cache_ttl). If you edit the file and see no change, wait five minutes before concluding it is ignored.
How much memory does an image upload need, and which constant raises it?
Memory is used when the image is decoded, not when it is uploaded. A rule of thumb is about four bytes per pixel, so a 4000 by 3000 photo needs roughly 48 MB just to sit decoded, before WordPress creates a single smaller size. Image editor code calls wp_raise_memory_limit( 'image' ) first, and core then raises the limit to WP_MAX_MEMORY_LIMIT or the original php.ini value, whichever is higher. The image_memory_limit filter changes that value. This corrects a common claim: image processing does not use WP_MEMORY_LIMIT, it uses the “image” context, which draws on WP_MAX_MEMORY_LIMIT.
Core defines WP_MEMORY_LIMIT as 40M on a single site and 64M on multisite, and WP_MAX_MEMORY_LIMIT as 256M, unless the host forbids changing the limit, in which case both follow the current memory_limit. If your php.ini value is above 256M, core keeps that higher value. To raise it for image work:
// wp-config.php, above the "stop editing" line (checked on 15 Nov 2026)
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );These constants only take effect if PHP allows memory_limit to be changed at runtime. Some hosts block that, and some enforce a cap outside PHP (a container or an account limit). Confirm the result in Site Health, where the PHP memory limit is listed, rather than assuming the constant worked.
Cause 2: could the image editor, Imagick or GD, or my PHP version be the problem?
Symptom. Every image fails, including small ones, while PDFs and ZIP files upload fine. Or uploads work but no thumbnails appear. The PHP error log may mention Imagick or GD, or may say nothing.
WordPress asks the wp_image_editors filter for a list of editors, with WP_Image_Editor_Imagick first and WP_Image_Editor_GD second, and uses the first one that works on the server. If neither extension is loaded, no image can be processed.
Check. In Site Health, Info, Media Handling, find “Active editor,” “Imagick version” and the GD version. When Imagick is the active editor, the same section lists its resource limits (area, memory, map, disk and so on). A low area or memory limit there, set in the ImageMagick policy by the host, makes ImageMagick refuse images your PHP limits would allow. You cannot change that policy from WordPress, so it is a host request.
The quick test. Force GD for a few minutes and retry. If uploads start working, the fault is in Imagick, its policy or its resources.
// Temporary test, remove afterwards (checked on 15 Nov 2026)
add_filter( 'wp_image_editors', function () {
return array( 'WP_Image_Editor_GD' );
} );Keep GD only as a stopgap. The long-term answer is fixing Imagick with your host.
Does the PHP version matter for uploads?
Yes, indirectly, and the usual trap is an extension that did not follow the upgrade. PHP extensions are installed per PHP version. When a host switches a site to a newer PHP, Imagick may be missing on the new version, and WordPress silently falls back to GD or finds no editor at all. The upload failure appears right after the upgrade, which makes people blame WordPress itself. Compare Site Health before and after, and use our PHP upgrade check to test on staging first. WordPress.org currently recommends PHP 8.3 or newer, so staying on an old version is not the fix either.
An older, widely reported variant is worth knowing. During the WordPress 4.5 era, core developers traced “HTTP error” reports to ImageMagick running several threads on shared hosting, and the suggested workaround on Apache was SetEnv MAGICK_THREAD_LIMIT 1 in .htaccess (see this 2016 forum thread). Reports are mixed on whether it helps, and we did not retest it on current ImageMagick builds, so treat it as something to try only if Imagick is the active editor and GD works.
Cause 3: why do big photos fail even when my limits look fine?
Symptom. A phone or camera photo, often 4000 pixels or wider, fails with “The server cannot process the image.” A downscaled copy of the same photo uploads.
Since WordPress 5.3, any image above a threshold is scaled down and used as the full size. The default threshold is 2560 pixels on either side, set through the big_image_size_threshold filter, and returning false disables scaling. The original is kept with a -scaled suffix on the new full-size file. That scaling is extra work on top of the sub-sizes, done in the same request.
Be careful with the obvious “fix.” Lowering the threshold makes the final files smaller, but the server still has to decode the full original once, so it does not rescue a server that runs out of memory on a 60-megapixel file. Disabling scaling makes the next steps heavier, not lighter. The practical fixes, in order:
- Raise memory for image work (Cause 1) so the decode succeeds.
- Resize before upload. The core error message itself suggests staying near 2560 pixels, and a tool that resizes on the member’s device removes the load from your server.
- If you must keep a different threshold, set it deliberately:
// Example: scale anything above 2000px (checked on 15 Nov 2026)
add_filter( 'big_image_size_threshold', function () {
return 2000;
} );If thumbnails are missing after a failed upload, rebuild only the missing ones. The command below is documented in the WP-CLI reference, and it processes images with the same code path that was failing, so run it on staging first for a large library.
wp media regenerate --only-missing --yesWhat changes in WordPress 7.1 with client-side media processing?
WordPress 7.1 moves image resizing, format conversion and thumbnail generation into the browser (compiled libvips running as WebAssembly) where the browser supports it. The core team’s announcement lists full support in Chrome and Edge 137 and later, with Firefox and Safari falling back to server-side processing. The browser also needs enough resources: more than 2 GB of device memory, at least two CPU cores and a network that is not 2G.
For troubleshooting this means two things. Large images no longer hit PHP’s memory limit on the supported path, but the browser now uploads the original plus every smaller size as separate requests to new sideload and finalize routes under /wp/v2/media/{id}/, so a firewall or rate limit can block a request that an old setup never saw. And the same site can behave differently in Chrome and Firefox, because only one of them takes the server path. The post lists wp_image_editors and image_memory_limit among the filters that do not run on the browser path, so Cause 2 and the memory tests above only apply when the server does the work.
To isolate it, retry the upload in Firefox or Safari, which use the server path, or disable client-side processing temporarily:
// Test only (filter named in the WordPress 7.1 announcement, checked 15 Nov 2026)
add_filter( 'wp_client_side_media_processing_enabled', '__return_false' );If the upload works with the filter on and fails with it off, check the network tab for a blocked request to a sideload route (Cause 6). If a Content Security Policy is set, the announcement says worker-src must allow blob:, or processing falls back to the server.
Cause 4: could a timeout be killing the upload?
Symptom. The upload hangs for a fixed time, often 30 or 60 seconds, then fails. The Network tab shows a 502 or 504, or the request is cancelled. Large files and slow connections fail more often.
Several separate clocks can stop one upload, and whichever fires first wins:
- PHP:
max_execution_time(30 seconds in the php.ini defaults) andmax_input_time. - PHP-FPM:
request_terminate_timeoutcan end the worker regardless of the PHP setting. - nginx:
fastcgi_read_timeoutandfastcgi_send_timeoutboth default to 60 seconds, andclient_body_timeoutdefaults to 60 seconds between two reads of the request body, answering with a 408 if the client stalls. - Apache with mod_fcgid:
FcgidIOTimeoutdefaults to 40 seconds. - A CDN or load balancer in front of any of the above, with its own limit.
Raising only max_execution_time therefore often changes nothing, which is why timeouts feel stubborn. Work from the outside in: find the layer that returned the error (the response headers on the failed request often name the server), then raise that layer’s timeout to cover the slowest realistic upload. Our guide to nginx and PHP-FPM behaviour covers how those two layers interact.
On the HTTP/2 question: we could not find a published fix that names HTTP/2 itself as a cause of upload errors, so we do not list it as one. If the Network tab shows a protocol error (for example ERR_HTTP2_PROTOCOL_ERROR) instead of an HTTP status, the connection was cut at the proxy or server, and the evidence is in the proxy error log. Ask your host to check it for the exact upload request time rather than switching protocols on a guess.
Why do uploads fail under load but pass when I test them?
memory_limit applies per PHP process, not per server. Five members uploading at once means five processes each holding a decoded image, and which request dies looks random. For intermittent failures, multiply your PHP-FPM worker count by the memory each can claim.
Cause 5: are file permissions, ownership or disk space stopping the save?
Symptom. Every upload fails the same way, usually after a migration, a restore or a server change. Your debug log may carry “Unable to create directory” with a note about the parent directory being writable by the server.
The uploads folder must be writable by the user PHP runs as, which is not necessarily the account that owns the files. A folder showing 755 is still unwritable if a different user owns it. The same family of failures includes a full disk or quota, and PHP’s own temp folder problems: core translates PHP’s upload error codes into messages such as “Missing a temporary folder” and “Failed to write file to disk.”
Check. In Site Health, Info, Filesystem Permissions, look at the “The uploads directory” line: it reports Writable or Not writable from the web process, which is the answer that counts. A command-line check such as is_writable() through WP-CLI answers for the user running the command, which on many servers is a different user than the web server, so it can say “yes” while uploads still fail. Then check disk space and inode quota in the host panel.
Fix. Give the PHP user ownership of the uploads directory (or group write with the right group), keep directories at 755 and files at 644 unless your host documents otherwise, and avoid 777. Making a folder world-writable hides an ownership problem and opens a security hole on shared servers. If members upload to your site, also read our guide on hardening a site that accepts member uploads, and the checklist for cleaning up after an upload vulnerability.
Cause 6: can a firewall, ModSecurity or a CDN block the upload?
Symptom. The failure is instant, with no processing delay. The Network tab shows 403 or 413, often with an HTML page that is not WordPress. Your debug log is empty, disabling plugins changes nothing and the PHP error log shows no entry, because the request never reached PHP.
Three layers do this:
- ModSecurity or another server WAF. It can reject a request on body size or on content that resembles an attack. One documented case shows ModSecurity denying a WordPress request with “Request body no files data length is larger than the configured limit (131072),” fixed by raising
SecRequestBodyNoFilesLimit, while file uploads are capped bySecRequestBodyLimit(Terresquall, May 2022). A February 2026 core Trac ticket (#64617) reports Apache logs showing ModSecurity access denied with code 403 onasync-upload.php, and argues the editor gives too little context to tell a core bug from a server block. - Web server body limits. nginx defaults
client_max_body_sizeto 1 MB and answers with a 413 when a request is bigger. With Apache and mod_fcgid,FcgidMaxRequestLendefaults to 131072 bytes (128 KiB) and exceeding it returns a 500. - A CDN in front. Cloudflare lists a maximum upload size of 100 MB on Free and Pro plans, 200 MB on Business and up to 5 GB on Enterprise, and returns a 413 beyond that (Cloudflare error 413).
Check. Note the exact time of a failed attempt and your IP address, then ask the host to search the web server and WAF logs for that moment. They should be able to name the rule ID or the limit hit. If you run your own server, the ModSecurity audit log and the nginx error log carry the reason in plain text.
Fix. Raise the specific limit that was hit, or exclude the upload routes from the specific rule. Do not switch the whole firewall off: you want the firewall in front of an upload form more than anywhere else. SVG and files containing text that looks like code trigger rules more than JPEGs do, so if only those fail, a content rule is the likely cause. On WordPress 7.1 also include the sideload and finalize routes in any allow rule, since a firewall that permits async-upload.php may still block them.
Cause 7: do plugins, themes or the browser cause the HTTP error?
Symptom. The server settings look fine, a clean test site uploads normally, and the failure follows one browser, one account or one plugin set.
Plugins and themes. Anything that hooks the upload can break it: image optimisers that recompress on upload, offload-to-cloud plugins, security plugins that scan uploads and plugins that print a notice or warning into the response. A PHP notice printed before the JSON turns a successful upload into an invalid response, which is the 200-but-HTML row in the table above. Deactivate everything except what you are testing, switch to a default theme, retry, then re-enable one at a time with the image optimiser and the security plugin first. Use a staging copy for live shops. Our guide on turning on the debug log properly helps you catch the stray output.
Browser. Try a private window with extensions off, because ad blockers and privacy extensions sometimes cancel the upload request. Try another browser, and check that your login has not expired in another tab. If a member reports the error and you cannot reproduce it, ask which browser and device they used: a phone on mobile data with a camera original is a different test from your desktop upload.
Roles. The allowed file types narrow for users without the unfiltered_upload capability, so test as the role that reports the problem, not only as an administrator. SVG is blocked by default on purpose, because an SVG can carry script.
What do people report most often, and where do they go wrong?
The box below lists recurring mistakes in public reports. Checked on 15 November 2026.
Common mistakes people report
- Retrying before checking the Media Library. In a 2016 forum thread users noted the images appeared in the library despite the error, and current core text says the file “may have been uploaded successfully.”
- Raising one limit and stopping. Guides often stop at
WP_MEMORY_LIMIT. Image processing uses the “image” context, which draws onWP_MAX_MEMORY_LIMIT, and a size rejection can come frompost_max_size, nginx or ModSecurity instead. Read the status code first. - Treating a 413 as a PHP problem. A write-up from Terresquall shows the limit sitting in ModSecurity, so editing
php.inichanged nothing until the WAF setting changed. - Disabling the firewall instead of one rule. A February 2026 core ticket describes a 403 from ModSecurity on the upload handler. Switching ModSecurity off for the whole domain is the common advice and removes protection the site needs. Ask the host for the rule ID.
- Blaming WordPress for a server timeout. A 2019 core ticket on gallery uploads failing with an invalid JSON response gave a server timeout as the usual cause. The clue was a long wait before the error, which is easy to miss if you never watch the clock.
- Forcing GD and never going back. Switching to GD makes the error disappear in many reports, such as the Trac ticket on image uploads failing since 4.5, but it hides an Imagick or policy problem, and GD can leave you without thumbnails.
Which fix should I try first?
Check | If it shows this | Do this |
|---|---|---|
Network tab status | 413 | Raise the lowest size limit: PHP, nginx or ModSecurity, then the CDN plan limit |
Network tab status | 403 with an HTML page | Ask the host for the firewall rule ID, then allow that rule for the upload routes |
Network tab status | 500 | Read the PHP error log, then raise |
Network tab status | 502 or 504 | Raise the timeout on the layer that answered |
Small image works, large fails | Scales with size | Memory, scaling threshold, timeouts (Causes 1, 3, 4) |
PDF works, images fail | Image pipeline | Site Health Media Handling, test GD, ask the host about Imagick |
Fails after a PHP change | Missing extension | Install Imagick for that PHP version |
Works in Firefox, fails in Chrome (7.1) | Client-side path | Check blocked sideload requests, test with the filter off |
Should I install a plugin to fix the HTTP error?
Usually not as a first step. Every cause above is a server setting, a limit, a rule or a file, so a plugin that “fixes upload errors” can only shift which limit you hit first. The exceptions are a plugin that resizes images on the member’s device before upload, which removes load from your server, and a security plugin you are using as the intended place to allow a file type. Even then, you still need to know the cause, which the status code gives you.
If members upload photos or files on your site, test the upload path as a real member on a phone with a camera original, not only as an administrator.
Frequently asked questions
Why does WordPress say “HTTP error” when the file did upload?
Because the error appears when the server’s response is unusable, and that can happen after the file was saved, during thumbnail creation. Current core wording says the file may have been uploaded and tells you to check the Media Library.
What is the maximum upload size in WordPress?
It is the lower of upload_max_filesize and post_max_size, passed through the upload_size_limit filter. Site Health, Info, Media Handling shows the effective value. Web server and CDN limits can be lower than PHP’s.
Do I need to disable big image scaling to fix the error?
No. The big_image_size_threshold filter defaults to 2560 pixels and scaling lowers the size of what you serve. Disabling it removes a step but not the cost of decoding the original, so it rarely cures the error.
Does WordPress 7.1 change how upload errors appear?
On supported browsers (Chrome and Edge 137 and later) the browser does the image processing and sends extra requests, so memory failures on the server become less common while blocked sideload requests become possible. Other browsers use the server path as before.
The short version
Read the status code, then match it to one of seven places: a size limit or memory, the image editor, the scaling step, a timeout, permissions, a firewall, or a conflict. Fix the layer that actually answered, confirm in Site Health that the change took effect, and test as the member role on a phone before calling it done.
Plugins we build and run
We maintain these ourselves, which is why we can support them on your site.
- BuddyNextThe self-hosted community engine for WordPress
- BuddyXFree community theme, Pro when you outgrow it
- ReignPremium community theme. Add pieces, build anything
- JetonomyCommunity forum and Q&A for WordPress
- EventonomyEvents and RSVPs for WordPress communities
- LearnomyCourses and learning communities on WordPress
- ListoraDirectories and listings your members can browse
- SnipShareCode sharing built for developer communities
- WB Ad ManagerAd placements that turn traffic into revenue
- WP Career BoardA job board your community actually uses
- WP Sell ServicesSell services with offers, orders, and payouts
- MediaVersePhotos, video, and media albums for members
- WB GamificationPoints, badges, and rewards that keep members active
- Product RoadmapPublic roadmaps with voting your users trust
Related Posts

LiteSpeed Cache Vulnerability CVE-2026-93389: Check Your Version and What Was Exposed

Freemius SDK Stored XSS: How to Find Every Bundled Copy on a Client Site (Anything Under 2.13.5)

