HTTP error medium
WordPress media library "HTTP error" / "An error occurred in the upload"
An image finishes uploading but WordPress fails on the resize step and shows a vague "HTTP error."
What you see
image.jpg HTTP error.
What’s actually happening
You drag an image into the media library, the progress bar fills to 100%, and then it dies with a red "HTTP error" and no detail. Retrying sometimes works, which is the classic tell of a memory or timeout ceiling being hit during image processing. Small images may upload while large ones fail. The message is deliberately generic — the real reason is in the PHP error log, not on screen.
Common causes
- The image-processing library is broken or missing. WordPress needs Imagick or GD to generate thumbnails; if neither is installed or Imagick is misconfigured, the resize after upload fails.
- PHP memory_limit is too low to hold a large image in memory while resizing. A 4000px phone photo can need 256M+ to process even though the file is only a few MB.
- max_execution_time or the web server's request timeout is hit mid-resize, so the request is killed before WordPress finishes generating all the thumbnail sizes.
- The REST API endpoint WordPress uses for uploads is blocked or rewritten by a security plugin, firewall, or mod_security rule, so the async upload call returns a non-JSON response.
- Wrong file permissions or a full disk on wp-content/uploads, so the resized files can't be written.
How to fix it
- Read the actual PHP errorTurn on logging: define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); in wp-config.php, reproduce the upload, then check wp-content/debug.log. You'll usually see either "Allowed memory size exhausted" or an Imagick/GD fatal — that tells you which branch below to take.
- Raise memory and execution limitsIn wp-config.php set define('WP_MEMORY_LIMIT', '256M');. In php.ini (or via your host panel) bump memory_limit = 256M, max_execution_time = 120, and upload_max_filesize / post_max_size above your image size. Restart PHP-FPM.
- Fix the image libraryCheck Tools > Site Health > Info > Media to see if Imagick or GD is active. If Imagick is flaky, install/enable the GD extension (php-gd) as a fallback. On a server: apt install php-gd && systemctl restart php8.x-fpm. WordPress will use whichever is present.
- Rule out the REST API / firewallOpen browser DevTools > Network, retry the upload, and inspect the failing request to /wp-json/wp/v2/media. If the response is HTML or a 403 instead of JSON, a security plugin or mod_security rule is blocking it. Whitelist the media endpoint.
- Test with a smaller imageResize the photo to ~1500px and re-upload. If that succeeds where the full-size failed, you've confirmed a memory/timeout ceiling — go back to step 2 rather than chasing the library.
Stop it recurring
Keep memory_limit at 256M and the GD extension installed so large uploads always have a working fallback path.
Related errors