Are you seeing HTTP error while uploading images, pdf, video or other media files to WordPress? HTTP error when uploading images is one of the most annoying things that can happen to your WordPress website.
Before we start discussing how to to solve image uploading issues, lets first talk about what causes this error.
The WordPress HTTP Error is usually displayed on shared hosting after trying to upload an image in the media screen and the upload fails. Hopefully, you won’t be getting this error and will only see it on this screenshot:
The short answer is: because WordPress was unable to determine the exact reason behind the image upload failure and therefore it displayed a simple and generic message – HTTP Error.
This is where the things get interesting if you’re like me and love troubleshooting/bug hunting (if not just skip to the next step) since WordPress doesn’t know the exact reason why this error happened, you have to try out various solutions to fix the issue.
So let’s take a look at how to troubleshoot and fix the HTTP error during media upload in WordPress.
The first thing that you want to do when you get this error is to try to upload the image again!
If this doesn’t work make sure that you are not running out of resources on your hosting package! Login to cPanel and on the right you will see the statistics section which highlights your account’s usage of resources.
In a lot of cases, the reason why you get this message is that you’re out of space! If that’s the case remove unused files from your server or contact your WordPress hosting provider to upgrade your package.
The most common cause of this error is lack of memory alocated for WordPress to use. To fix this, you simply need to increase the amount of memory PHP can use on your server.
You can do this by adding the following line to your wp-config.php file.
1 | define( 'WP_MEMORY_LIMIT' , '256M' ); |
This will increase the WordPress memory limit to 256MB, which would be enough to fix any memory limit issues.
Another way to increase PHP memory limit is to edit the php.ini file located in your root directory. Open the file with text or code editor and increase the value for the memory_limit setting.
.htaccess file is another hidden file same as php.ini so to show it please enable it in the settings, like showwn on the screenshot below:
Open the .htaccess file with editor and change the “php_value memory_limit” value.