WordPress shows HTTP Error when uploading images

While working on my blog today WordPress shows HTTP error when uploading images, I was confused and helpless. I tried to upload the image again & again, but the error won’t go. After 5-6 attempts I was able to again upload the images successfully. But my success was short lived as after a few minutes the same error comes knocking at my door.

WordPress shows HTTP Error when uploading images

While there are many fixes available for the above problem but then again they will waste your time, that’s why I am going to Fix this HTTP error when uploading images and after you are done with this article I can assure you that this error message will be long gone.

Fix for WordPress shows HTTP Error when uploading images

Image Size

This first and obvious thing to check for is that your image dimensions don’t exceed your fixed width content area. For example, let’s say you want to post 3000X1500 image but the post content area (set by your theme) is only 1000px then you will definitely see this error.

Note: On the other hand always try to limit your image dimensions to 2000X2000.

While the above may not necessarily fix your issue but again it’s worth checking. If you want to check WordPress guidelines on images please read here.

Increase your PHP memory

Sometimes increasing the PHP memory allowed to WordPress seems to rectify this issue. Well, you can never be sure until you try, add this code define(‘WP_MEMORY_LIMIT’, ’64M’) into your wp-config.php file.

increase php memory limit to fix wordpress http IMAGE error

Note: Don’t touch any other settings in wp-config.php or else your site will completely become inaccessible. If you want you can read more about Editing wp-config.php file.

To add the above code, just head over to your cPanel and go to the root directory of your WordPress installation where you will find the wp-config.php file.

Wp-config php file

If the above doesn’t work for you then there is a good chance that your web hosting provider doesn’t allow you to increase PHP memory limit. In that case talking directly to them can help you in changing the PHP memory limit.

Adding a code to .htaccess file

To edit your .htaccess file just navigate to Yoast SEO > Tools > File Editor (if you don’t have Yoast SEO installed, then you should install it and you can read about how to configure this plugin here). In .htaccess file just add this line of code:


set env magik threat limit to 1

After adding the code just click “Save changed to .htaccess” and check if the issue is resolved .

Changing theme functions.php file

Actually, we are just going to tell WordPress to use GD as the default WP_Image_Editor class using theme functions.php file. As of WordPress latest update GD has been abstracted and Imagick is used as a default image editor, so going back to the old one seems to fix the issue for everyone.

Recommended: Apparently, there is also a plugin to do so, go here. But if you want to manually edit the file then continue below.

To edit the theme functions.php file just navigate to Appearance > Editor and select Theme Functions (function.php). Once you are there just add this code at the end of the file:

add_filter( ‘wp_image_editors’, ‘change_graphic_lib’ );

function change_graphic_lib($array) {
return array( ‘WP_Image_Editor_GD’, ‘WP_Image_Editor_Imagick’ );

Note: Make sure you add this code within the ending PHP sign ( ?>)

Theme functions file edit to make gd editor as default

This is the most important fix in the guide WordPress shows HTTP error when uploading images but if your issue is still not fixed, continue forward.

Disabling Mod_Security

Note: This method is not advised as it can compromise the security of your WordPress and hosting. Only use this method if you have tried everything else and if disabling this works for you then contact your hosting provider and ask for support.

Again go to your file editor via  Yoast SEO > Tools > File Editor and add the following code to your .htaccess file:

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off

mod security disabled using htaccess file

And click “Save changed to .htaccess.”

Reinstalling the latest version of WordPress

Sometimes this issue can occur because of corrupt WordPress file and any of the above solutions may not work at all, in that case, you have to reinstall the latest version of WordPress:

  • Backup your Plugin folder from cPanel (Download them) and then disable them from WordPress. After that remove all of the plugins folders from your server using cPanel.
  • Install the standard theme e.g. Twenty sixteen and then remove all other themes.
  • From Dashboard > Updates reinstall the latest version of WordPress.
  • Upload and activate all the plugins (except the image optimization plugins).
  • Install any theme you want.
  • Try using the image uploader now.

This will fix WordPress shows HTTP error when uploading images.

Miscellaneous Fixes

  • Don’t use apostrophe in the image files names e.g. Aditya-Farrad.jpg
  • Try to change the extension of the file.
  • Disable all the plugins.
  • Make sure your host has the latest version of PHP installed.
  • Contact your Hosting Provider for support.

This is the end of this guide and I hope by now you must have fixed the issue WordPress shows HTTP error when uploading images. If you still have any question regarding this post feel free to ask them comments.

Like and share this blog post in the social networks to help spread the word about this problem.

About The Author

1 thought on “WordPress shows HTTP Error when uploading images”

Leave a Comment

Your email address will not be published. Required fields are marked *