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.
8 solutions for the HTTP error
Sometimes, the error can appear just once, for a particular image, but if it persists, try the following solutions or talk to your host.
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 (height and width) image, and as you can see, it did trigger the error.
Now let’s get to our solutions:
1. Decrease the image’s 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. Add this code
define('WP_MEMORY_LIMIT', '64M') into your wp-config.php file. This setting may not work if your host does not allow you to increase the PHP memory limit, so I suggest talking to your support directly and ask them to change the limit for you. You’ll skip the hassle.
- Read this guide if you need to know how to access and edit your WordPress files.
5. Add one of these codes in .htaccess:
# Exclude the file upload and WP CRON scripts from authentication
Allow from all
Deny from none
AddType x-mapp-php5 .php (at the very top of your .htaccess file)
NOTE: I always warn people when “playing” in .htaccess. 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+. Once, when we were on HostGator, 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.
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.
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! 😀