You’ve just finished writing a great blog post, and you try to upload an image to the media library. But instead of uploading, you get a vague, red error box that simply says “HTTP Error”.
This error is notoriously difficult to diagnose because WordPress doesn’t tell you exactly what went wrong. However, there are a few reliable ways to fix it.
1. Check if the Error is Temporary
Sometimes, the HTTP error is just a temporary glitch caused by unusual server traffic or low resources. Before trying any complex fixes, simply wait a few minutes, refresh the page, and try uploading the image again.
Also, check the image size. If your image is over 2MB or has huge pixel dimensions (like 4000x3000px), resize and compress it before uploading.
2. Increase the PHP Memory Limit
Uploading and processing images takes memory. If your server runs out of memory during the upload, it will throw an HTTP error.
The Fix:
Add this line to your wp-config.php file to increase your memory limit:
define( 'WP_MEMORY_LIMIT', '256M' );
3. Change the Image Editor Library
WordPress uses two different PHP modules to handle images: Imagick and GD Library. Imagick is known to cause memory issues on shared hosting, leading to the HTTP error. You can tell WordPress to use the GD Library as the default instead.
The Fix:
Add this code snippet to your theme’s functions.php file:
function change_image_editor( $editors ) {
$gd_editor = 'WP_Image_Editor_GD';
$editors = array_diff( $editors, array( $gd_editor ) );
array_unshift( $editors, $gd_editor );
return $editors;
}
add_filter( 'wp_image_editors', 'change_image_editor' );
4. Check wp-content/uploads File Permissions
If WordPress doesn’t have the correct permissions to write to the uploads folder, your images will fail.
The Fix:
- Connect to your site via FTP.
- Navigate to the
wp-contentfolder. - Right-click the
uploadsfolder and select File Permissions. - Ensure the numeric value is set to 755 and check the box to “Apply to directories only”.
- Click OK.
- Now, right-click the
uploadsfolder again, set the permissions to 644, and check the box to “Apply to files only”.
These steps resolve the vast majority of WordPress HTTP upload errors.
