Image Showing How To Fix The Http Image Upload Error In 2021

Our brain processes images at a faster rate than words. This helps images communicate a wide range of information, even very abstract notions. Images on websites tell stories, compliment text set the tone, and identify your brand.

It’s easy to see why being unable to upload photographs is every website administrator’s worst fear. Furthermore, receiving a vague and useless notice such as “HTTP error” can add to the problem.

You’ll have to learn how to work around the unwanted faults or problems that come with any platform. We’ve seen a lot of them, so trust us when we say we’ve seen them all! 

WP has its share of oddities, from the white screen of death to database connection issues. But we adore it! Today, we’ll look at the WordPress HTTP error, which is one of the most common. When trying to upload images or videos to the WordPress media library, users run into this issue.

While the HTTP error is simple to resolve, it can be inconvenient because it interrupts your workflow. Nothing is more stressful than spending 20 minutes looking for the perfect image for your blog post, then going to submit it, and then facing a confusing error message.

We’ll walk you through the many causes and solutions for the HTTP issue that occurs when uploading images in WordPress.

You can also use these ways if you’re having trouble uploading files, PDFs, or any other WP media files.

Let’s explain why this error occurs and what you can do to easily fix the HTTP Image Upload Error so you can resume uploading your files.

What does HTTP error in WordPress mean

When using the built-in media library tool to upload images or videos, if something goes wrong, it can result in a WordPress HTTP error. Unfortunately, unlike browser failures, which provide an HTTP status code, WordPress issues can be a little more difficult to detect, especially if you don’t know how to enable WordPress debugging mode.

The generic word “HTTP error” doesn’t help you figure out what’s wrong or even where to start looking. But that’s because there could be many reasons for the failure, and WordPress doesn’t know which one to blame. So it only throws out a generic error message.

Image Showing What Does Http Error Means

How to Fix the WordPress HTTP Error

According to our experience, the cause of the WordPress HTTP error could be due to two things:

A client-side or user error (e.g., your login session, bad characters in the file name, etc.) and

A problem or setting on your WordPress host (server issue, memory list, third-party plugin, shared hosting throttling resources, etc.), so we’ll do a little bit of both.

Here are some recommendations and things to check to fix the error:

Refresh the Page

When you get a WordPress HTTP error, the first thing you should do is only refresh the website in your browser. Isn’t it too simple? Actually, this is the most typical solution we’ve seen. This is why:

First, your browser may have lost connection with WordPress for whatever reason. Due to this, the procedure may have failed to complete. The cause behind it could be your ISP, a temporary problem with your WP server, or something else. The problem will sometimes fix itself if you refresh the page and try uploading again.

Second, we’ve noticed that it sometimes forces you out after refreshing the page or returning to the WP editor from another tab. 

Your WordPress login session has most likely expired, as shown by this message. The following message should appear:

So you log back in and try to upload your files once more, and the HTTP error occurs. This is a characteristic of WordPress. After logging back in, you must manually refresh the page you’re on. Then you’ll be able to upload media again.

Image Showing Refreshing The Page

Confirm the HTTP Error

A WordPress HTTP error can occur due to a temporary server issue. Before you try any of the suggestions in this article, make sure the mistake is always present.

Start by waiting a few minutes and then re-uploading the media file. If the second try succeeds, it’s possible that the cause of the error was a temporary difficulty.

Also, clean up the picture file name by removing special characters, such as apostrophes and semicolons, among other things. After removing the characters from the filename, a large number of customers reported that the fault was resolved.

If the problem persists, continue reading for more solutions.

Switch Browsers

It’s possible that the WordPress HTTP problem has nothing to do with the website. The cause of the error might be something else entirely — your browser.

HTTP errors have been reported to appear when using Google Chrome. While it is a great browser, switching to another will allow you to determine whether the issue is browser-related.

More troubleshooting procedures are listed below in case the problem persists.

Deactivate Plugins

If you get a WordPress HTTP problem after installing a plugin, the best thing you can do is deactivate it. Image optimization plugins are known to cause this problem, so that will save you some time. As a result, if you’re using an image optimization plugin, turn it off for now and try uploading the image again.

If the HTTP problem goes away, you might want to hunt for another image optimizer plugin. Or, you might try contacting the plugin’s developers to further troubleshoot the issue.

If the error remains after disabling all plugins, continue to the next step in the list below.

Image Showing How To Deactivate Plugin

Increase WordPress Memory Limit

Image Showing How To Increase Wordpress Memory Limit

A lack of memory is a common cause of the HTTP error in WordPress. It can also lead to a variety of other problems. These include the 503 services unavailable message. It’s as simple as adding the following line to your wp-config.php file to fix low memory:

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

Your PHP memory limit is increased to 256MB with the code above. Before you add it, you should check PHP data to see what the greatest available RAM limit on your server is.

Make GD Library Your Default Image Editor

Did you know that WordPress includes two image editors? That’s true; wordPress processes pictures using either Imagick or the GD Library. While they are both excellent, Imagick is known for taking up all the available memory. This can also result in an HTTP error.

To get around this difficulty, set GD Library as your default editor. How? Simply paste the following code into your theme’s functions.php file:

function hs_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', 'hs_image_editor_default_to_gd' );

Save your edits before attempting to re-upload the image. Revert the code modification and try the next remedy if the HTTP error continues.

Editing .htaccess

Image Showing How To Edit The .Htaccess

The .htaccess file is located in the root folder of your WordPress installation. This file serves as a gatekeeper in many ways. It manages where requests are sent, among other things.

Open .htaccess and add the following code to fix the HTTP issue in WordPress:

SetEnv MAGICK_THREAD_LIMIT 1

After that, try adding your file again to check if the problem has been resolved. If that doesn’t work, here are some other code snippets to try:

<IfModule mod_security.c>

SecFilterEngine Off

SecFilterScanPOST Off

</IfModule>

Or

# Exclude the file upload and WP CRON scripts from authentication

<FilesMatch "(async-upload\.php|wp-cron\.php|xmlrpc\.php)$">

Satisfy Any

Order allow, deny

Allow from all

Deny from none

</FilesMatch>

Try implementing them one at a time. Also, make sure to save your changes before re-uploading your media file.

Check Your Theme

Image Showing How To Check Your Theme

If the error occurred after installing or updating a WP theme, then that theme is almost certainly to blame. Making a backup of your complete site and switching to the default theme is a good strategy.

If everything works ok with the default theme, contact your current theme provider or developer for more information. In this situation, the cause of the HTTP error could be a single theme problem. It can also be a conflict between the theme and a plugin.

Check Your PHP Version

WordPress requires PHP 5.2.4 or higher to work smoothly since version 3.2. If you don’t do this, you’ll end up with an HTTP error. Some hosts utilize outdated versions of PHP. This means you won’t be able to upload photos to the WordPress media library no matter what you do.

What should I do? To begin, make sure your host is running PHP version 5.2.4 or higher. Or, you may join millions of other website owners with Hostinger. Hostinger always has the most up-to-date stable PHP version.

Shrink or Resize the File

You may need to make changes to your image file. The changes include reducing the file size (KB or MB) or reducing the width/height (pixels). We recommend reading our in-depth guide to image optimization for the web. When you upload your image to the media library, you can use a variety of third-party image optimization plugins. These plugins can help you to perform both shrinking and resizing.

We’ve been using Imagify on our Kinsta site for years with no problems. But there are many other excellent options. Only make sure that whichever plugin you use optimizes photos on their own servers rather than locally. If you mass optimize photos locally, this can have a significant negative impact on your site’s performance.

Image Showing How To Shrink Or Resize The File

It’s fine to use high-resolution photographs because WordPress already supports responsive pictures. In fact, you’ll want to do so so that the image on the retina display seems crisp.

You may also need to test with the PNG and JPG file formats. Depending on the sort of photograph, one may be larger than the other.

You could also want to look into increasing the WP largest upload file size, depending on your WordPress host’s configuration.

Rename the Image File

It’s never a bad idea to rename the image file. If you try to submit a duplicate file name, WordPress should automatically attach a number to the end. But if it doesn’t work, try changing your file. Unfortunately, once submitted, WP does not allow you to rename an image file that has already. So you will have to rename it locally and then upload it again.

We usually add a -1 or -2 to the end of photos that already exist when uploading them.

If you don’t include the dash, Google will see it as a single word, which could harm your SEO.

Also, avoid uploading images with file names that contain special characters to be safe. This includes symbols and characters from other languages, such as apostrophes. Dashes are acceptable.

 Ask Your WordPress Host

If you’ve already tried the steps above and are still experiencing the WP HTTP issue, try contacting your WP host for help before continuing. 

Many of the following troubleshooting tasks are a little more technical. Due to which these tasks can often have your host perform or check these for you.

Increase PHP Memory Limit

Another reason for the WordPress HTTP error is that your server does not have enough RAM to complete the background upload operation. With shared WordPress hosting, this is a pretty common issue. To repair the problem, you’ll need to increase PHP’s memory limit. A least 256 MB is suggested.

Request an increase in your PHP memory limit by contacting your site hosting company. Gradually increase the size of the image until you can upload one that you like. The smallest width of 2000px is required.

  • Increase PHP Memory Limit with wp-config.php

If you wish to do it yourself, edit your wp-config.php file as follows. Only if your hosting package includes that much memory it will continue this work. Gradually increase the size of the image until you can upload one that you like.

Add the following code to your wp-config.php file to increase the PHP memory limit. Note that a server-level rule set by your WordPress host may override this.

define( 'WP_MEMORY_LIMIT', '256M' );
  • Increase PHP Memory Limit in cPanel

If your host uses cPanel, you have two options for increasing the PHP memory limit.

You can find the first under the software category. Choose “Select PHP Version” from the drop-down menu. Select “Switch to PHP Options” from the drop-down menu. You can then alter the value of “memory limit” by clicking on it.

The second area is also found under the software tab. Select the “MultiPHP INI Editor” tool from the drop-down menu. This gives you access to the php.ini configuration file. Simply scroll down to the “memory limit” field and increase the value.

Image Showing How To Increase Php Memory Limit In Cpanel

  • Increase PHP Memory Limit with php.ini

If you don’t have access to cPanel, you can edit the php.ini file directly if you have it. To do so, use FTP or SSH to connect to your site, then navigate to the root directory and open or create a php.ini file.

If the file already exists, look for the “memory limit” setting and make any necessary changes.

For the above php.ini file settings to operate, you may need to add the suPHP directive to your .htaccess file on some shared hosts. To do so, change your .htaccess file. This file is likewise placed at the root of your website, and add the following code at the top:

<IfModule mod_suphp.c> 

suPHP_ConfigPath /home/yourusername/public_html

</IfModule>
  • Increase PHP Memory Limit with .htaccess

The .htaccess file is a hidden file that contains many settings that you can use to affect server behavior down to the directory level. If you don’t have access to php.ini, move on to the next step. To begin, connect to your site through FTP or SSH and check your root directory for a.htaccess file.

If there is, you can alter the “php value memory limit” value in that file.

Disable mod_security

Mod security is an open-source firewall that might sometimes result in a WP HTTP error. You can disable the Mod security by placing the following code at the beginning of your .htaccess file.

<IfModule mod_security.c>

SecFilterEngine Off

SecFilterScanPOST Off

</IfModule>

If you’re using cPanel, you can also disable it by going to the “Security” section and clicking “ModSecurity.”

Image Showing How To Disable The Mod Security

Then change the status of the domain you wish to disable from “On” to “Off.”

Image Showing How To Change The Status Of The Domain

Instead, we always suggest using a WAF like Sucuri or Cloudflare. They both are which are both enterprise-grade and cheap. Our recommendations for the best WAF settings may be found here.

Install the Add From Server Plugin

Finally, if you’re stuck and nothing else seems to be working, you can download and install the free Add From Server plugin. Maybe you’re waiting for your WP host or a developer to respond with advice on how to fix the WordPress HTTP issue.

Image Showing How To Install The Add From Server Plugin

The Add to Server plugin will usually work around the problem. The plugin may be a useful temporary fix, especially if you’re in the middle of something critical. It was created with the intention of allowing you to upload huge files via SFTP. This plugin is no longer being updated or supported. You should use it at your own risk.

Conclusion

As you can see, there are a variety of approaches to resolving the WordPress HTTP issue. Hopefully, one of the options listed above worked for you, and you’re back on track with your media uploads. If you’re getting this problem on a regular basis, it might be time to upgrade to a more capable WordPress host.

Also Read- How To Create Customized WordPress HTTP Error Pages

Load More Related Articles
Load More By Susana Taylor
Load More In Wordpress

Leave a Reply

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