HTTP Error When Uploading an Image
“HTTP error” appears when the media uploader fails during processing. The message is generic because the failure happens in a background request whose response WordPress could not interpret. Work through these in order.
The short version
- Try a smaller image first. It separates resource limits from everything else.
- The image editor library is the commonest real cause.
- A security plugin or firewall blocking the request is second.
- The browser console shows the actual error the uploader hid.
First: narrow it down
- Upload a very small image, under 100KB. If that works, you have a resource limit.
- Upload a different format — PNG if JPEG failed. If one format works, it is the image library.
- Try in a private window. If that works, a browser extension is interfering.
- Open the browser console during the upload. The failing request often carries a real error message.
1. Memory and execution limits
Image processing is memory-intensive, particularly for large photographs. Raise both:
// wp-config.php
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
# php.ini or .user.ini
memory_limit = 256M
max_execution_time = 300
upload_max_filesize = 64M
post_max_size = 64M
post_max_size must be larger than upload_max_filesize, or uploads near the limit fail silently.
2. The image editor library
WordPress uses ImageMagick if available and falls back to GD. ImageMagick is better but fails more often, usually due to a server configuration or a missing delegate. Force GD:
add_filter( 'wp_image_editors', function () {
return array( 'WP_Image_Editor_GD' );
} );
Put that in your child theme’s functions.php. If uploads start working immediately, the problem is ImageMagick on your server — worth telling your host, because GD produces slightly worse output.
3. A security plugin or firewall
Firewalls sometimes block the upload request because it looks like a file-write attempt. Deactivate the security plugin temporarily and retry. If that fixes it, allowlist the uploader rather than leaving the plugin off.
4. mod_security
A server-level firewall rule can block uploads with no useful message. You cannot usually see or change these yourself — ask your host to check the mod_security log for the time of your upload. They can disable the specific rule.
5. The .htaccess upload rule
Occasionally a rule in .htaccess interferes. Rename it and test:
mv .htaccess .htaccess-off
# test the upload, then regenerate by saving Settings → Permalinks
6. A theme or plugin conflict
Last, because it is least likely for this specific error. Switch to a default theme and disable plugins, then reintroduce.
Diagnosis table
| Test | If it works | Cause |
|---|---|---|
| Small image uploads | Large does not | Memory or execution limit |
| PNG works, JPEG does not | — | Image library |
| Works with security plugin off | — | That plugin |
| Works in a private window | — | Browser extension |
| Works with .htaccess renamed | — | A rewrite rule |
| Nothing works | — | Ask the host to check mod_security |
Common questions
Why is the message so vague?
The uploader expects a JSON response. When the request fails or returns HTML, it has nothing specific to report and falls back to “HTTP error”.
Should I resize images before uploading?
Yes, regardless. Uploading a 6000-pixel photograph so WordPress can shrink it wastes processing and storage every time.
Does this affect existing images?
No. It only affects new uploads.
Sumit
Writes everything on TechMozz.