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!
In my case my proxy server was causing the problem.
What was happening with your proxy? I’m facing the same issue and I think its because of the proxy.
I had this issue for a long time now. I could only upload small files. Everything else gave me an HTTP error. I finally got it FIXED.
My hosting provider eventually, after a lot of time trying to figure it out, found that the issue was in the Apache configuration file and that the “LimitRequestBody” was set to 200kb. After adjusting that, everything was fine again!
So, if nothing else works, have your hosting provider look at that file and see if it is set too low.
Thanks for the tip! Recently, we experienced something similar on a project. We started receiving the HTTP error right from the beginning. After trying everything that we knew, the hosting company finally fixed it by switching our PHP version to 7.
So I was having this problem as well, and that got me here.
I had a plugin “WP Smush” installed. Was the first I deactivated, and viola! All images are uploading…. I think you should add “all image compressing/editing plugins should be deactivated first.
Regards
Ahhhhhhh thankyou so much! It was a sneaky apostrophe that was causing it!
AddType x-mapp-php5 .php works perfectly. Thanks!
“HTTP Error” is like so many other errors: a totally useless error message that tells you nothing about the problem encountered. However, I’ve found that the problem is most often a timeout condition of the upload process. There may be dozens of ways to work around the problem and resolve it. But ultimately, I usually just turn off the script timeout.
You need to edit 3 files in your WordPress installation. Add the line: “set_time_limit(0);” without the quotes somewhere near the top of each of the following 3 files. Don’t forget the semicolon. Make sure that you don’t accidentally put it inside a comment block.
Modify: /wp-admin/upload.php
Modify: /wp-includes/wp-db.php
Modify: /wp-includes/class-wp-image-editor-gd.php
And then — and this is the hard part — remember to reapply these changes every time you upgrade wordpress. Setting the time limit to anything other than zero, sets a timeout to that number of seconds. It’s probably safest to give it some value other than zero (which means no time limit), but I just give it zero and if it runs too long, I can close the browser.
…..where I said “without the quotes” …. also without the added backslashes….
Thanks for your input! The backslashes are caused by a plugin conflict, which we are still working on. I removed them from your comment.
Helped me a lot, thanks
I have tried the FTP access suggestions, adding code to .htaccess, and nothing worked for me. I found a super old-looking website that suggested making sure the file path was correct. And that’s what my issue was! I cloned this site to create a sister site (for my client’s sister company), and I assume something happened there. The pathway for all the media was linking to the sister site on the main site. UGH.
Here’s the info:
Incorrect Pathways
Login to your wp-admin
Click on Settings
Choose the Media option from the left menu.
The path should display wp-content/uploads. If not, correct the path.
Hopefully this helps someone!
Thanks for pointing this out! I’ll add it as a fix.
I had the http error problem….SO annoying. I just deactivated the JetPack plugin. It’s pretty useless anyway, with so many better plugins you can use.
Yeah, the Jetpack plugin can cause a lot of issues in a lot of different places. We used it once in our WordPress beginnings and then stopped using it.
hellow, why this ist not work for me, iam using wordpress 4.7.4
i have already increase memory limit, put thats code on .htaccess and my problem to upload image on wordpress is not sucess..
any one have solutions for wordpress 4.7.4 ?
Backup your site and then switch your current theme with a default one from WordPress (e.g. Twenty Seventeen). See if the problem persists.
The apostrophe worked for me! Couldn’t believe it!
A solution that worked for me and many others, was somehow mentioned above, but here’s an easier way to implement it:
Apparently there’s a long standing open bug in WP, related to the thumbnails creation library, which was changed in v4.5 to a more “efficient” lib – causing all sorts of weird problems that no one was able to fix since.
https://core.trac.wordpress.org/ticket/36534
This support thread mentioned a solution, and indeed it worked for me and many others: get back to using the old thumbnails lib.
https://wordpress.org/support/topic/media-upload-not-working-http-error/
This can be achieved by installing the plugin from here:
https://github.com/getsource/default-to-gd
or by simply adding the code in the plugin to the theme’s (and preferably the child-theme’s) functions.php file.
Hope this will help others
Yuda
You have provided very nice information. It really helped me. I personally appreciate your article on the topic “solutions for the HTTP error”.
I used wp smuch and it happened to me as well. So took measures that are mentioned in your article and the problem is solved now
Thanks, I had an apostrophe in a PDF title. very useful article
If you are tired of trying all the “solutions” suggested around the internet to this infuriating problem, here is a foolproof method to get your images, videos, or other accepted file types into the WordPress Media Library:
http://www.conferencesthatwork.com/index.php/technology/2017/07/how-to-solve-the-infuriating-http-error-when-uploading-images-or-videos-to-wordpress/
I tried many ways but i was unable to fix this problem
But finally installed WP-optimize plugin By David Anderson, Ruhani Rabin, Team Updraft and it works successfully.
The same problem i was facing in chrome browser, but in Mozilla everything was fine..
someone can help me? i have done 10 ways from above.. but it’s still not working.. what should i do? install back my wordpress i think :(
Have you contacted your hosting company?
This problem comes and goes for me. None of these solutions have worked. What did work was simply emptying the cache. I’m using the Varnish Cache plugin, and clicking “Empty Cache” resolved the error. I hope this helps someone. :)