How to Fix WordPress HTTP Error When Uploading Images
In WordPress, an HTTP error is a code that signals that something went wrong during a file upload process. Typically, the WordPress HTTP error occurs when you try to add an image and other types of files to the media library. This guide covers 9 proven solutions to this problem in no particular order. Without further ado, let us get started!
Download all in one WordPress cheat sheet
9 Easy Ways to Fix WordPress HTTP Error
Let us overview possible fixes for the HTTP error when uploading images to WordPress. In addition, the following solutions will work for you whether you’re uploading an image, a video, a PDF file, or any other file type that WordPress accepts.
Solution 1: Confirm the HTTP Error
At times, a temporary glitch in the server may cause a WordPress HTTP error. Before you try any of the solutions in this post, first you should ensure that the error always persists.
Begin by waiting a few minutes and uploading the media file once again. If the second attempt is successful, it could mean that a temporary problem occurred at the time of the error.
Additionally, clean up the image file name, i.e., eliminate characters such as apostrophes and semi-colons among others. A good number of users reported the error as resolved after removing apostrophes from the filename.
However, if the problem persists, read on for more solutions.
Solution 2: Switch Browsers
It is possible that the WordPress HTTP error is unrelated to the website and could be the result of something more unexpected – your browser.
There have been reports of HTTP errors popping up while using Google Chrome. While it is an excellent browser, switching to a different one will let you confirm if the problem is browser-related.
In case the problem persists, more troubleshooting steps are presented below.
Solution 3: Deactivate Plugins
If the WordPress HTTP error appeared after installing a plugin, your best chance is to deactivate it. To save you some trouble, image optimization plugins are known to cause this issue. As such, if you have an image optimization plugin, disable it temporarily and try uploading the image once more.
If the HTTP error disappears, you may try looking for an alternative image optimizer plugin. Alternatively, you could try to get in touch with the plugin developers to troubleshoot the error further.
However, if the error persists even after disabling all plugins, move on to more solutions presented below.
Solution 4: Increase WordPress Memory Limit
A common cause of the HTTP error in WordPress is a lack of memory. It can also result in many other issues such as the 503 service unavailable error. Fixing low memory is a matter of adding the following line to your wp-config.php file:
define ('WP_MEMORY_LIMIT', '256M');
The above code increases your PHP memory limit to 256MB. Before adding it, you should also confirm what the maximum available memory limit is on your server by checking PHP info.
Solution 5: Make GD Library Your Default Image Editor
Speaking of magic, did you know WordPress ships with two image editors? That’s right, WordPress uses either Imagick or the GD Library to process images. While they are both great, Imagick is notorious for exhausting the available memory and causing the HTTP error.
To circumvent this problem, you need to make GD Library your default editor. How? Just drop this 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 changes and try to upload the image again. If the HTTP error persists, revert the code change and try the next solution.
Solution 6: Editing .htaccess
The .htaccess file lives in your WordPress root folder and acts as a gatekeeper for all sorts of things. It controls where requests go among many other functions.
To fix the HTTP error in WordPress, open .htaccess and add the following code:
SetEnv MAGICK_THREAD_LIMIT 1
Once done, attempt to add your file again to see if the issue was fixed. If it did not work, there are a few more code snippets that you can test:
<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 individually, save the changes and upload your media file once again.
Solution 7: Check Your Theme
If the error showed up after installing or updating a WordPress theme, then it most likely the culprit. A good approach is to create a backup of your entire website and switch to a default theme (e.g., Twenty Seventeen).
If all works well with a default theme, try contacting your current theme provider or developer with the details. In such a case, the HTTP error could be an isolated theme issue or an incompatibility between the theme and a plugin.
Solution 8: Check Your PHP Version
Since version 3.2, WordPress requires PHP version 5.2.4 or higher to run smoothly. Anything short of this will leave you stuck with the HTTP error. Some hosts use older versions of PHP, which means no matter what you try, you can’t upload images to the WordPress media library.
What to do? First, check with your host to ensure they are using PHP version 5.2.4 and above. Alternatively, you can join millions of other website owners at Hostinger, which offers the latest stable PHP version upon release. Opt for the dedicated WordPress plans for the best experience.
Solution 9: Clear Your Caches
Do you still face the WordPress HTTP error after trying all the above solutions? Perhaps you solved the error a while ago, but the “error” you see comes from the local cache. Before you leave thinking no solution works for you, try clearing your browser cache.
Suggested Reading
How to Fix the upload_max_filesize Error in WordPress
Error 404: 4 Ways to Fix It
10 Ways to Fix the “Sorry, You Are Not Allowed to Access This Page” Error in WordPress
How to Fix the “Deceptive Site Ahead” Error: 4 Steps to Remove It
How to Fix WordPress White Screen of Death: 7 Solutions
How to Fix WordPress Mixed Content Error Using Plugins and the .htaccess File
How to Fix the 403 Forbidden Error
Conclusion
Getting the HTTP error when uploading images to WordPress is not the best of feelings. We are, however, confident that one of the solutions above will fix this error once and for all.
Have you ever encountered the WordPress HTTP error before and fixed it with a different solution? If so, don’t hesitate to share your experiences in the comment section below!
WordPress HTTP Error FAQ
Now that you have learned some of the ways to fix WordPress HTTP errors, here are some frequently asked questions.
What Does HTTP Error Mean?
HTTP error refers to an error status code sent by a server in response to a client request. It indicates that there was an issue with the communication between the server and the client, and the request could not be fulfilled.
What Is the Most Common WordPress HTTP Error?
There are various HTTP errors that can happen to your site. The most common WordPress HTTP error is the 500 Internal Server Error, often due to issues with the server, theme or plugin conflicts, corrupted files, or other technical issues.
How Do I Prevent HTTP Errors in WordPress?
To prevent HTTP errors in WordPress, you can try optimizing images, disabling plugins or themes causing conflicts, and increasing the PHP memory limit. If the HTTP errors persist, try checking for file permissions and updating WordPress to the latest version.
Comments
September 16 2018
Browsers did it for me. I have no idea why. Failed in Firefox, worked in Safari. Weird.
November 14 2018
Changing browser did it for me. So easy when you know how. Thanks
November 16 2018
Changed max_execution_time from 30 seconds time out to 60 and this fixed my HTTP error.
December 05 2018
I tried several of these suggestions. The .htaccess one worked. Thank you so much for this article!
December 06 2018
Yes my friend!! Step 3 worked an absolute treat! I was only getting the error for certain images then never getting it for others which seemed really strange. Switched from Chrome to Firefox and had the same situation. I then went back to Chrome and disabled all of the plugins and the upload was perfect. So.... I dragged in 25 images at once.... perfect! And mega fast as well!! I'm going to disable the plugins individually to ascertain which one causes the issue and it will make it more straightforward each time. Thank you so much, you're a ledge!!!
December 11 2018
THANK YOU!!!! I skipped to #6 editing .htcaccess because that's what everyone was saying it was... but #3 plugins was the winner! This would have saved me so much time! Thank you!!!
March 08 2019
First suggestion was all I needed - I eliminated an apostrophe in my file name :) Thanks for taking the time to put this together.
March 21 2019
Thanks man!!! For me, selecting GD Library did the trick! Have a nice day!
March 25 2019
Solution #4 worked for my site
April 26 2019
SetEnv MAGICK_THREAD_LIMIT 1 did it for me. Thank you!
May 11 2019
Thank you! Thank you ! Thank you.................
June 05 2019
You're a life saver!
July 11 2019
Changing to GD Library did for me...
August 17 2019
"Solution 5: Make GD Library Your Default Image Editor" worked for me. Thanks!
September 15 2019
GD Library fixed my issues.... thank you guys for helping through out this blog..
September 25 2019
Thanks a lot! Solution 5. did it for me! :) Very good document this is. Keeping it bookmarked!
September 28 2019
THANK YOU ! Got to #2 and that fixed it straight away :-) woo hoo
October 29 2019
THANK YOU - finally, a troubleshooting article that is written properly. This did the trick. Great job and keep up the good work
November 10 2019
Great solutions I am sure as by the comments. I simply reloaded the page and it worked!
May 23 2020
awesome .. thanks for the help