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!
Our problem was that our load balancer ran out of hard disk space. Be sure to setup a log rotation that deletes the oldest logs after a period.
I have tried this and this really helped
Hi
I had the same problem and it turned out to be a plugin so I disabled it and the image or photo uploaded without the error.
The Plugin was Image Optimizer WD. If that’s going to prevent me from uploading other media files then I’ll have to find an alternative.
Thank you for you help as it solved the problem.
Colin
This is so helpful for me.thank you
Thank you for all the attempts – unfortunately none of them worked for me. However I finally found the fix that nailed it perfectly. Adding this line to the very top of the .htaccess file:
SetEnv MAGICK_THREAD_LIMIT 1
good luck to everyone else!
Thank you Max and Amanda for letting us know this! We really appreciate it!
Hi, I’m Still facing the same issue, I’ve even minimized the size of the image or the resolution even I’ve followed your rules as well.
Can you tell me what should I do?
Hello! Well, if you did try everything pointed out in the article, especially deactivating all the plugins and switching to a default WordPress theme, then it means that it’s most likely a hosting problem, since you ruled out the theme and plugins. So I recommend contacting them, tell them what you’ve done so far, and kindly ask them for assistance.
You Beauty – that suggestion of 7) Update – don’t have an apostrophe in the image file’s name! was absolutely spot on!
Fantastic – after uploading many photos of only 400Kb or there abouts, this WORKED!
A Huge thanks you to the contributors.
idk if anyone’s tried switching browsers but after failing solidly for one hour working on Opera, I opened my blog up on Brave and the original pic uploaded immediately.
Great article,
You had several other things to try that I did not find anywhere else. I tried everything I found here in your nice article as well as everything else that I could fine elsewhere and nothing worked for me.
Finally out of curiosity I decided to try uploading from another web browser and that did the trick. I was using Google Chrome and it was not letting me upload but after I switched to Firefox everything worked perfectly.
Keep up with the helpful articles. :)
Heya! Thanks for contributing! I think someone else has pointed out that before as well. Since it seems to be a valid fix, I’ll update the article and add it :D. Thanks again for sharing this with us!
This article got me working. Thanks… I de-activated all of my plugins, and it worked… As I started looking at them, I noticed one that you had in your list, EWWW Image Optimizer. It was not my culprit, I then noticed one called Imsanity. The description was “Imsanity stops insanely huge image uploads” That was the big culprit for me. Not even sure how it got installed in the first place. It’s deactivated now and life is good again.
wait whatt..?? just solve my problem by rename it to a simple filename :D, from blablabla blalala.jpg to logo.png ^_^ ..
Thanks worked for me, Just added it to WP .htaccess file for my website http://www.rohitpoint.com
SecFilterEngine Off
SecFilterScanPOST Off
I tried everything but not working to solve the pdf upload error, after 50% pdf upload it automatically goes to HTTP error, how to solve it?
Hello! Is it only happening with .pdf files? Have you tried using another.pdf file? Use a very small one and see if it works.
Since you said that you tried everything pointed out in the post, also try deactivating all your plugins and see if that solves the issue (create a backup first). If it does, activate them one by one until you find the culprit. Also, check your error log in your control panel (usually cPanel) because it might point out the issue. As a final solution, talk to your web host.
Thought I’d chime in since none of the other tips worked for me but I figured it out: refresh your page.
Basically, I opened a “new post” page then left for the evening. When I returned in the morning, I wrote my post but got the HTTP error when I tried to add an image to my post.
My login hadn’t timed out overnight, but obviously something had, because when I clicked “save draft,” I also received a WordPress error. However, the draft had autosaved, and when I opened it back up, images uploaded just fine.
Another solution is not using file with other languages name. for example if the file name is in Farsi change it to English before upload
Thanks for pointing it out! I’ve added it as a potential fix in the post.
Well, i don’t understand why WordPress does not do anything about this problem.
I just got it and searched around. It’s a problem that has been for years now.
It seams that the core problem is with WordPress. I don’t know why some of the other solutions will work for some. But this is what works if everything else fails:
function ms_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', 'ms_image_editor_default_to_gd' );
And i don’t know why the image size should be a problem at all. There are so many photographers that uses WordPress. But they must all use some theme that adds this function(or some other) to get rid of the problem.
All the best
Carsten
Thanks for your input!
Don’t know if WordPress is really the culprit. Usually, from my experience, the problem is caused by the file, the server, the theme, a plugin, or a combination of those. The file sizes usually don’t matter for WordPress, but in some cases, depending on the website’s setup, it might cause an error.
Hmmm, you taught me something new today. Thanks!
Problem solved by method number 10!!! I was moving wordpress and changing my domain name. It ended up with wrong path in “Store uploads in this path”. I changed it to default ale voila !
Thank you very much!
Awesome! Thanks for letting me and the others know.
We just became a new company. We have a new server and it was working fine and then after 3 weeks no more uploads. The IT keeps thinking it was word press but we can upload on WiFi. So the problem aren’t the files or the host but the server who limits us to size because I can upload a one page document. I’m starting to see it may actually be the server limiting us to size.
They should look into it. If the size is limited and you have your own server, the fix is easy.