Best 16 methods to fix HTTP errors when uploading images to WordPress

Every platform has some pros and cons. Talking about cons, almost every platform gives some errors which are frustrating and annoying like database connection errors, HTTP errors, white screen errors, etc. You must know how to get rid of them and know the way out of such errors and problems.

Like any other platform, WordPress also runs into HTTP errors when you try to upload images using a build-in media uploader without giving any reason for that error. This error is annoying as you spent considerable time choosing the image for your blog post and spent a lot of time editing that image as per your blog need. Finally, after doing all these you try to upload that image to WordPress and you get an HTTP error with no cause. This is frustrating.

Sometimes, when you upload an image in WordPress using the built-in media uploader, you get an HTTP image upload error. This is frustrating, as we do not get the actual cause of the error. In this article, you will come to know the possible causes of these types of errors and their solutions.

What is an HTTP error during uploading images?

In WordPress, during uploading an image you may face an HTTP image upload error. This error is basically the code that indicates that something went wrong during the upload and needs to be fixed. This type of error occurs when you try to upload media to WordPress using a built-in media uploader.

HTTP error WordPress

Unlike browser errors, where we get the error code and can reference that error code for the actual problem and its solution, WordPress errors are a little difficult to solve (as we do not get the actual cause of the error).

However, WordPress can not figure out the actual cause of these errors but these errors can be fixed using the solutions in this article.

What are the reasons that cause HTTP errors when uploading images?

There are many reasons for these errors to occur such as too large image files, plugin causing issues, WordPress memory limitation, etc. WordPress is unable to figure out the actual cause of the error. We need to figure out the cause and then fix it.

Some causes of the error are:

1. Plugin Issue

If the HTTP error occurs after installing some new WordPress plugin, then chances are there that plugin might be causing the issue or hindering the media upload that causes an error.

2. Theme Issue

If you have switched to a different theme and observed the HTTP error, then possibilities are there that theme might be causing the error.

3. WordPress Memory Limit

There are chances that your WordPress memory limit is low and hence during the upload of media, it runs into memory shortage, and consequently, it causes the error while uploading any media.

4. Default image editor

Imagick is the default image editor of WordPress and is known for consuming more memory than other image editor libraries. When you upload the media, it exhausts the available memory in WordPress causing the error.

5. Wrong filename

Sometimes, we unintentionally insert a special character in the filename. If any special character, like colon or semi-colon, is present in the name of the file, WordPress will give the HTTP error.

How to fix the HTTP errors during image upload

As WordPress does not figure out the actual cause of the error and we need to figure it out and fix it. So we need to try the hit and trial method in order to fix the error. We have already discussed some causes of this type of error and now we will see the solution to the above causes and some more causes.

Some of the solutions are:

1. Refresh the page

The first and foremost thing you should do whenever you encounter an HTTP error is to refresh your browser page. There are possibilities that your browser might have lost connection temporarily with WordPress and the uploading process simply failed to complete.

Sometimes, WordPress logs you out, for whatever reason, when you refresh the page you see the login page and a message “Your session has expired. Please log in to continue where you left off.” This indicates that your login session has expired and you must log in again to continue.

Session Expired

2. Check your filename

Sometimes, you end up editing your image file by naming it including the special characters. This gives an error in uploading that file to WordPress.

Check the name of your file. It should not contain a special character like a semicolon, equal sign, apostrophes, etc (dashes are OK). If it is there remove it and try re-uploading it with a new name (without special characters).

Check Filename

If the error persists, then follow the next solutions.

3. Switch the Browser

It might be possible( but the possibility is less) that the error is unrelated to the website and the browser is causing the issue, you may try switching the browser and re-upload the image.

This may solve the problem. If not, read on for more solutions.

4. Reduce the size of the file

The size of the file may be the reason for that error. In order to get rid of that error reduce the size of the file which you want to upload. You may decrease the width/height (pixels) of the image to reduce the size of the file. You can use the tools available offline as well as online to optimize the image for you.

There are many plugins available that can do this for you when you upload the image.

5. Make sure the error is not temporary

You may get an HTTP error in WordPress on uploading images or any other media sometimes because of low server resources or unusual network traffic on WordPress hosting servers. This issue is fixed automatically after the network traffic is reduced or resources needed by your website are available on WordPress hosting servers, and your website can use them. You may experience this too, resulting in an HTTP error while uploading images or other media.

In this case, you should wait for a few minutes so that traffic is reduced or necessary resources are available to use on hosting servers and try re-uploading the media. Also, try reducing the size of the image or the format of the image and uploading it. If it does not work then try other solutions.

6. Deactivate Plugin

There are some situations where some plugins like image optimization plugins (they tie directly into the media library) and security plugins like WordFence hinders the uploading of the image and thereby, give up the HTTP error while uploading the image. Security plugins are sometimes too restrictive and hinder the uploading of the image.

If you have recently installed any plugin, and then get the HTTP error on image upload. There might be a possibility that the plugin is causing the issue. You may uninstall the plugin and try re-uploading the image. This might solve the issue. If not, follow other solutions.

deactivate plugin

If you do not want to affect your live site then simply clone the site to the staging environment and then try out the solutions on the cloned site. Later, apply these changes to your live site.

7. Switch Theme

The same is the case with themes, although they do not directly tie into the media library sometimes, themes may also cause this issue. In this case, backup your data and switch to a default theme (twenty seventeen), and then try to upload the image.

However, changing the theme of your WordPress site will not affect your data as your data is safely stored in the database. You may also stage up your live site and change the theme on your staged site to see the results without affecting your live site. Later, switch the theme on your live site as well.

twenty-seventeen theme

This might solve the problem if the HTTP error is occurring because of the theme.

8. Check uploads folder permission

When there is a permission error for any folder in WordPress, it gives an appropriate message of not being able to write to the directory. But this is not always the case. If WordPress is infected with malware or hacked, there could be a lot of permission-related issues. So it is better to check the folder permission before attempting other solutions.

The main folder to be concerned about is /wp-content/uploads. This is the folder where all files are stored which are uploaded via the media library.

You can use the FTP client to see the permission of your uploads folder.

folder-permission

According to the WordPress Codex, all directories should be 755 (drwxr-xr-x) or 750.

9. Increase WordPress Memory Limit

One of the causes of this type of error is the lack of memory available for WordPress to use to upload the image in the background. This cause is the most common cause in the case of shared WordPress hosting. In order to fix it, you must increase the memory limit of WordPress so that PHP can use it on the server.

To increase the memory limit of WordPress, you need to add the following code to your wp-config.php file. The wp-config.php file is present in the root folder of the website.

This code will increase the memory limit of WordPress to 256MB, which is enough to upload the media.

10. Change WordPress Image Editor Library

WordPress uses PHP and to handle images PHP uses two modules. These modules are the GD library and Imagick. WordPress uses either of them depending on the availability of the library. They both are great in their work but Imagick is known for exhausting available memory and running into memory issues causing the HTTP error because of lack of available memory.

To fix this issue, we can change the default Image Editor Library to the GD library.

To do this, just add the following code to your theme’s functions.php or a site-specific plugin.

 

After adding this code to the functions.php, try re-uploading the image. If it does not work, remove the code from the theme’s functions.php and try other solutions.

11. Make Changes to the .htaccess file

The .htaccess file is present in the root folder of your website and it acts as the control of the website. It controls the requests to the functions. Many shared hosting providers limit Imagick to use multiple threads for faster image uploading which causes the HTTP error.

To fix this issue, you can add the following code to your .htaccess file:

This code limits Imagick to using a single thread to process the image.

Now, try re-uploading your image and check if the problem is solved.

12. Check the PHP Version

WordPress requires PHP version 5.2.4 or above (since WordPress version 3.2) to run smoothly. Some hosts use an older version of PHP. If the PHP version is older then you may get this type of error.

The solution to this is to ask your hosting company to upgrade your PHP version or choose a hosting company that provides you with a newer and stable version of PHP.

13. Disable mod_security

Mod_security is basically an open source firewall that may hinder in uploading of images and give the WordPress HTTP error. In order to disable the mod_security so that it does not hinder the process of image uploading, you can add the following code to your .htaccess file on the top.

This code will disable the mod_security firewall and thereby, preventing the WordPress HTTP error to occur during the file upload.

14. Clear the Cache

Are you still getting the error? There might be a possibility that you have solved the error previously while attempting previous solutions and the error which you are seeing is coming from the cached data of your browser. Clear the cache memory of the browser and try uploading the image. This may solve the issue.

15. Install Add From Server Plugin

If you have tried all of the solutions listed above and are still unable to solve the problem then last but not least solution is to install the free plugin available name Add Server Plugin.

Add from server logo

This is a temporary solution for the issue, you can add this plugin to your website till you are waiting for a response from your WordPress host or a developer on how to get the WordPress HTTP error resolved.

It can be considered a good temporary solution if you are in the middle of some important task. It was originally developed to allow you to add very large files via SFTP.

Important: This plugin is no longer maintained or supported. Use this plugin at your own risk.

16. Talk to customer support

If none of the above-mentioned methods work, the last option only left is to contact your web hosting customer support.

While for any type of error you must contact your customer support but it should be your last resort. If you have tried all the mentioned methods and still encounter the same error, there are higher chances that it causes due to some issue from the server side.

So, by contacting the support team of your web host, their expert team may be able to figure out the issue and resolve it as soon as possible.

Conclusion

Due to lack of exact reason, encountering an HTTP error when uploading pics on WordPress can be irritating and frustrating. But the best part is, that you can still able to fix this issue, by using the above-mentioned methods and you do not need to add any code or access core files.

If even the customer support team isn’t able to help you, you can move anytime to the more reliable and better WordPress host (WPOven).

If you have more solutions to fix HTTP errors while uploading pics that we have not mentioned in our post, Feel free to mention them in the comment section below, we will definitely add them.

Frequently Asked Questions

What does an HTTP error mean when uploading a photo?

HTTP error is a code that occurs when you are trying to upload a picture to WordPress. This error can be frustrating but it is temporary and generally fixed automatically.

Why am I getting HTTP error when uploading images to WordPress?

Since the HTTP error when uploading images to WordPress can occur multiple of reasons, Some of the most common reasons are:
1. Plugin compatibility Issue
2. Theme Issue
3. WordPress Memory Limit
4. Default image editor
5. Wrong filename
6. Issue from the server side

How do I fix a photo upload problem?

You can fix a photo upload problem by using these simple methods:
1. Refresh the page
2. Check your filename
3. Switch the Browser
4. Reduce the size of the file
5. Make sure the error is not temporary
6. Deactivate Plugin
7. Switch Theme
8. Check uploads folder permission
9. Increase WordPress Memory Limit
Change WordPress Image Editor Library

Leave a Reply

Your email address will not be published.