This post was last updated on 9/5/2018
I believe many people encountered this HTTP error when uploading images to WordPress.
The last time this happened to us was several days ago, after the hosting transfer, so I thought to share with you several solutions that may help you solve this problem.
This error appears after the image is “struggling” to upload for a while. Sometimes, the image is uploaded even if the error appears.
Most of the time it’s the image’s size (height and width) that causes this, so trying to upload big images could trigger the issue.
13 solutions for the HTTP error
Sometimes, the error can appear just once, for a particular image, but if it persists, try the solutions below.
Here’s how the HTTP error looks like when you try to upload an image:
In order to make a screenshot of the error, I’ve tried to upload a big sized image, and as you can see, it did trigger the error.
Now let’s get to our solutions:
1. Optimize the images by decreasing their size. Don’t add a 2000 x 1500 image, for example. If your post content area is 700px wide, don’t add an image larger than that.
2. Change the image’s extension from .png to .jpg, or vice versa, then upload it again.
3. If the problem appears after installing a plugin, deactivate it and try it again. Some plugins can trigger the error.
4. Increase your PHP memory by adding this code define('WP_MEMORY_LIMIT', '64M')
into your wp-config.php file.
Increasing your PHP memory limit might not work if your host does not allow you to increase the PHP memory limit, especially on shared environments.
So, I suggest talking to your web host’s support and figure out a solution.
Read this guide if you need to know how to access and edit your WordPress files.
5. Add one of these codes in .htaccess:
<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>
or
AddType x-mapp-php5 .php
(at the very top of your .htaccess file)
The codes can differ from server to server, so it’s best to contact your hosting support and ask them if it’s alright to add one of the codes, or ask them to do it for you.
6. Check with your hosting company to make sure that they are using PHP 5.2.4+ and they haven’t limited anything regarding uploads.
Once, when we were on HostGator (this is an affiliate link), someone from support was checking out an issue and discovered that we didn’t have the correct version of PHP. So it’s a good thing to “bug” your hosting support and ask them.
7 (Update). This fix was pointed out by a couple of our readers. We thank them for that!
Make sure you don’t have an apostrophe in the image file’s name (e.g. mary‘s-wedding.png), because that will trigger the error as well.
8 (Update). If you’re using an image optimizer plugin, deactivate it and see if that solves the issue. If the plugin was the cause, try different configuration settings or contact the plugin developer.
We’ve experienced such an issue with the EWWW Image Optimizer plugin, which triggered the HTTP error when we were uploading PNG files. It was working fine with JPEG files, but PNGs are better in some cases, so we really wanted to fix the issue, which we did, with the help of the developer.
9 (Update). Backup your site and then switch to a WordPress default theme (e.g. Twenty Seventeen). If the problem is solved, then it’s a theme issue or a hosting related issue (see below why).
First, contact the theme developers to have a look. If they can’t seem to fix it, contact the hosting company.
Scenario – this happened to us recently. I received the HTTP error and nothing worked until I switched themes and the problem was solved. So it had something to do with the theme or the theme combined with something else.
I contacted the theme developers and they managed to partially fix the issue by installing a thumbnail regeneration plugin, but when I deactivated the plugin, the problem reappeared.
Since I don’t like having unnecessary plugins installed, especially for something that should work fine from the start, I didn’t let it go.
After checking things out with Chrome’s Developer Tools, I’ve spotted a server error, so I contacted the hosting company which changed the PHP version to 7, and that fixed the problem!
10 (Update). This was pointed out by Ellen in the comments section.
Check your file path, especially if you migrated your site.
Got to Settings -> Media and check the path at Store uploads in this folder under Uploading Files. It should be something like /home/username/public_html/wp-content/uploads
.
11 (Update). This was pointed out by Vivek Kumar and Niche Apex in the comments. Thanks!
Switch to another browser, especially if you are using Chrome, which seems to trigger the HTTP error.
12 (Update). This was pointed out by BekBek in the comments. Thanks!
This fix already worked for some, and it might work for many others.
Try uploading the images only via Media -> Add New -> then Select files.
13 (Update). This was pointed out by pjmarket in the comments. Thanks!
If your image file name is in another language (e.g. Farsi, Mandarin, and so on), rename it and use English.
Even though WordPress allows you to upload file names using different languages, sometimes, it might cause an error.
If none of the above solutions work, then you should definitely contact your hosting support. If you have a good hosting company, I’m sure they will help you out and solve the issue for you.
Conclusion
It can be very annoying and frustrating getting that HTTP error when uploading images to WordPress, but I’m pretty sure that one of the above solutions will work for you.
Usually, the problem is the image itself, so start with the easy solutions first, like decreasing it to web-size or changing its extension.
Hope the post helped you out! Don’t forget to share!
You can also follow us on Twitter and subscribe to our YouTube channel.
If you want to start your own WordPress blog, or need a website for your business, our WordPress installation service is at your disposal!
It was the EWWW Image Optimizer for me – thanks for this post, it was helpful
Glad it worked!
This is a great post. I’ve been searching around for a good solution for my users. Thanks for sharing.
Thank you for your appreciation!
Hi, it gave me realy trouble. Because of that i want to share my solution with all of you.
In my case this happened because of WP Jetpack plugin, I realize it after disabled it.
I suggest you try this :) It helped me in my case :)
Hello! Thanks for the solution! It doesn’t surprise me that Jetpack could cause an issue like this, to be honest.
This issue was solved by tech support for me by changing the name of my “php.ini” file to “php5.ini” Hmmmmm. That’s new for me. My client is using a cheap/reseller host, so maybe they have variation in their filenames. Who knows, but now my images upload fine.
Helpful analysis ! Just to add my thoughts , you are wanting a IRS W-2 , my colleague filled out and esigned a sample version here
https://goo.gl/5xU1aW
I know this is super late to the game, but perhaps it will help someone else who comes across this post. If you\’re attempting to modify your wp-config.php file the code should be:
define(\’WP_MEMORY_LIMIT\’, \’64M\’);
Note the semicolon at the end. Without it, your site will likely throw an error.
Thanks for the post. I hope this helps though.
step 1 and 2 are the major cause of this in all my experience, if you try it and it doesn’t work for you, try it again by decreasing the size, dimension or resolution of the image. It can be frustrating though …….lol
Hey,
I had an issue too and found out that my share host was running php version 5.5.36. I had to add “AddHandler application/x-httpd-php56 .php” to the .htaccess file to get the server to run php 5.6
I hope this helps
The PHP update (which I changed within cPanel) worked perfectly. I was on PHP 5.2 and changed to 5.4.
Great!
The tip to change from .jpeg to .png worked a treat, thank you!
Great!
Hi,
We are experiencing this issue for .docx file uploads.
Whenever an user tries to upload .docx file in our contact us page(we used contact form 7 plugin), they get HTTP error(502 Bad Gateway error), not only for that plugin, even for any type of plugin.
We are so excited to receive a reply from your side.
Hello!
A 502 error usually means that the server killed the process because it was taking too long to complete. This can happen for a lot of reasons, and it can be quite tricky to find sometimes.
The first thing I’d do is to rule out the hosting company and make sure the problem is not with their server (it usually is in situations like these :D), especially if you know you’re not on a quality hosting company, which doesn’t have infrastructure that can handle WordPress. If the server is not the issue, you need to check WordPress, the plugins and the theme, and for that I’d recommend someone who’s good at troubleshooting WordPress errors, like a developer or something.
Hi,
I had this issue in one of my installations.
My solution was to change php to fast-cgi.
Cheers
Hello! Thanks for sharing!
This is a new issue in most of wordpress updates. Thanks for revealing.
I get the message if I have left a post open on my computer, say, overnight. It’s the same situation in which, if I were to edit, then update the post, I get the message, “Are you sure you want to do this?” In the case of the image, it never tells me it’s a refresh problem. But after I do refresh, I can upload the same image with no problem.
Very Simple we can solve this HTTP Error. If you uploading the images from the desktop just move them to any drive and try uploading and you can do it easily.
I’m at a complete loss right now. I’ve tried everything suggested here, and other places that I’ve looked, and still nothing. I moved 3 WP installations to a new host a few months back and two of my WP installations work fine. The third is giving me the dreaded HTTP error. I’ve tried everything here, including removing ALL plugins. I’ve also tried returning my .htaccess to a bare-bones one, as well as wp-config.php. Nothing seems to work. I’ve tried many different files too (all small like 100kb) and in different formats such as .jpg .jpeg and .png. The same file I’m testing with I can quickly load into the other 2 WP installations, so I know it’s not the file. So…
– It’s not the image file
– It’s not the .htaccess
– It’s not the wp-config.php
– It’s not the plugins
– 2 other WP installs work fine with the test images
– Everything else works fine with the site but image uploads
– Hosting company support has no clue
– Running PHP Version 5.4.16
– Memory limit 128MB
Any ideas? TIA…
Hello!
I’m sorry that this is happening to you. I know how frustrating it can be, I had my share…
From what I see, it can come down to this:
– The theme. Switch the theme with a default one from WordPress, and then check again.
– The theme and plugins. If just switching the theme doesn’t do it, then switch the theme and disable all the plugins; check again. Some plugins may be incompatible with the theme(s).
– The hosting. Since you’re saying that they don’t have any idea, I’m assuming you’re on Godaddy? :). They usually don’t know what’s going on. You need to check with them again, especially regarding the PHP memory. It happened to us once (not on GoDaddy), where we would increase the PHP memory, the hosting support would do it too, but after a while they realized that it won’t take effect if we are on a shared or cloud environment. You could download a plugin like WP-ServerInfo or Server Status to check the statistics of your server.
– Some themes also require a higher version of PHP, so that 5.4.16 may cause some trouble. You should ask the devs.
That’s all I can think of right know… Let us know what happens. Oh, and don’t forget to make a full backup before switching the theme and stuff.
I actually figured it out! Because I moved web hosts, I had to go into the options table and remove the value for the upload_path field. Once I did that, everything was fixed.
Oh yeah, that makes sense :D. I’m glad that you figured it out!
Thank you. In my case plugin was what caused this error.
Thanks a lot!
Now working great :)
I think it may cause because of deactivated themes or hacked themes
No this is not because of hacked theme, look here the full documentation about the solution of http error while image upload in WordPress
http://khojdo.com/http-error-while-image-upload-in-wordpress-version-4-7-2-step-by-step-tutorial-solved/