Fix WordPress HTTP Error When Your Uploading Images

http error when uploading images to wordpress

The HTTP error when uploading images to WordPress is generic and as such, can have many causes. WordPress does not indicate which is causing you to get the error, so you need to learn various ways of solving this unknown problem. There are a few of them, so without further ado, let’s begin troubleshooting.

Note that the HTTP error can also be received when uploading almost any media file to the Media Library, so the suggestions are good for more than just images.

7 ways to fix HTTP error when uploading images

1. Wait a while

Believe it or not, waiting is sometimes enough. This is because whatever caused the HTTP error when uploading images to WordPress was temporary. Perhaps you momentarily lost connection with your server, or unusual volumes of traffic interrupted your session. Giving WordPress a few minutes could help.

You should refresh the page as well. Your session may have timed out while you were waiting, so though the error may have resolved itself in the background, you won’t know. A simple refresh of your page will let you know if you were logged out. Log in again and upload your media file.

2. Explore more browser-solutions

Change browser: The next simple solution is to switch browsers. If you are successful, then the error was localized to your browser. Chrome usually returns HTTP error when uploading images to WordPress.

Clear browser cache: Imagine fixing the error and not knowing it. This would drive even the most patient among us silly. Because your computer doesn’t always fetch the latest version from the site itself, it may be loading directly from your cache. Clear it and force your computer to pull the web page directly from the Internet.

3. Check the file

Review the file name: Were you able to upload other media before getting this HTTP error when uploading images to WordPress? Check that your file name doesn’t include special characters. The apostrophe is a common one. Remove them and try uploading again.

Check file size: Another common file error could be with the size. It could be too large an image to upload. Increase your file upload size to the maximum 256 MB and try again. You can do this by inserting the following line of code to your wp_config.php file:

define('WP_MEMORY_LIMIT', '256M');

4. Deactivate plugins

We hope by now you would have found a solution to your error message, but if not, there are still a few solutions left, which we are sharing according to complexity. The next solution is to deactivate plugins (and possibly your theme). Don’t worry; this is temporary.

Image optimization plugins have been known to return an HTTP error when uploading images to WordPress. If you are repeatedly able to upload the image after deactivating the plugin, you have two choices. You can reach out to the developer for help if this is the plugin you prefer using. Or you can download another similar plugin in the hopes that it will not contribute to the error.

5. Configure permissions folder correctly

There are restrictions in place that govern who can make certain changes to certain sections of your website. Under normal circumstances, the website developer and/or owner (aka you) should have access to all areas of the backend. In the unlikely event that you do not have all permissions, you could be faced with the HTTP error when uploading images to WordPress.

To check folder permissions, you will need to access wp-content/uploads. Follow this file path: public_html >> wp-contents >> uploads.

  • Right-click on ‘uploads’
  • Select ‘File Permissions’
  • Check all three boxes under ‘Owner permissions’
  • Ensure 755 is written in the ‘Numeric value’ field

6. Ensure you are using the latest PHP version

WordPress requires that you use PHP version 7.4. Running anything less could cause HTTP errors when uploading images to WordPress. If your hosting provider does not run the latest version, switch to Hostific. You can either use a plugin to check with a version of PHP you are running, or check via cPanel.

7. Adjust image editor library settings

Let’s stick with PHP a bit longer (we did say the solutions were getting complex). When uploading images to WordPress, there are two modules that WordPress can use to support the process. Imagick is the more demanding of the two in terms of resources, so you are more prone to seeing HTTP errors when uploading images to WordPress.

a. Make Imagick work for you

Imagick requires a lot of resources to function effectively, so any wholesale attempt to curtail its functions might result in HTTP errors when uploading images to WordPress. Instead, make the module work for you by inserting one line of code into your .htaccess file:

SetEnv MAGICK_THREAD_LIMIT 1

Switching to VPS hosting or even dedicated hosting can solve this problem as well because of greater server resources.

b. Exclusively use GD library

You can force WordPress to use the other, called GD Library, with a few lines of code inserted into your functions.php file:

function wpb_image_editor_default_to_gd( $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', 'wpb_image_editor_default_to_gd' );

Of course, there are also plugins to help you force WordPress to use GD Library.

Conclusion

As we stated at the beginning, there are several reasons for seeing the HTTP error when uploading images to WordPress. Because you do not know what is causing it, you may need to try multiple fixes. We recommend that you start from the simplest and work your way up to more complex solutions.

We couldn’t list every solution here, so feel free to let us know if these work, and/or if you need to learn more solutions.