How to Fix the HTTP Image Upload Error in WordPress?

How to Fix the HTTP Image Upload Error in WordPress?

When you are uploading Media Files on your website, and it starts giving HTTP error. Then, what will you do?

Let’s take a look, how to fix the HTTP error message during the media upload.

What is HTTP Error?

In WordPress, HTTP Error is a message that tells something went wrong during the file upload process. Mostly this error comes when you are uploading the media files using the inbuilt WordPress Media Uploader.

Display Http Error On Upload Image

Why HTTP Error occurs?

HTTP Error is one of the most common problems to face when you are working with images in WordPress. It is not always a problem with your Plugins or WordPress but may be related to your server or memory limit problem.

This error message doesn’t provide any hint to users. So, most of the people get puzzled, how to fix this HTTP Error message.

In that case, you have to find out the different ways to fix the error.

Method 1) Confirm the HTTP Error is not Temporary

Firstly, check that the problem is not temporary. Wait for a minute and upload the media file again if it’s successfully done then it is a temporary problem. The reason may be due to unexpected traffic and lower resources.

If it’s not, Then you have to check the name of the image, maybe it has some special characters ( like an equal sign or a semi-colon ). If yes, then rename your image name.

Then check by uploading the other file and if it uploads the file. Then reduce your image size and upload again. It may resolve the upload error.

At last, change the image’s extension from .jpg to .png or vice-versa, upload again.

Still, your message does not disappear then it confirms your HTTP error message is not temporary.

Method 2) Increase WordPress Memory Limit

A common cause of HTTP Error message in WordPress is lack of memory. It can also cause many other issues such as 503 Services Unavailable Error. To increase the Memory Limit add the below code in your wp-config.php file:

define( 'WP_MEMORY_LIMIT', '256M' );

Above code increase your Memory Limit to 256 MB. Firstly, check the maximum available memory limit on your server.

Method 3) Change GD Library as Your Default Image Editor

Did you know WordPress works with two Image Editor? These are GD Library and Imagick to process images. Memory issues might create while uploading images using Imagick leads to an HTTP Error. To remove this error, You have to make GD Library as a Default Editor. How?

Just paste the below code in your theme’s function.php file.

function wpb_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', 'wpb_image_editor_default_to_gd' );

Save your changes. Again upload the image. If HTTP Error message still shows then remove the code and try another method.

Method 4) Editing .htaccess Method

In WordPress, there is a .htaccess file. In your WordPress root folder, it works as a gatekeeper for all sort of things.

This method controls the working of Imagick and also allows it to how much it has to use server resources. Many shared hosting providers limit the ability of Imagick to use multiple threads for faster image processing. That is the reason you see HTTP Error while uploading images.

Add the following code to your .htaccess file :

SetEnv MAGICK_THREAD_LIMIT 1

Save the changes and upload the media files once again.

Method 5) Confliction with the Plugin

You might face problems due to confliction of plugins. Firstly, check that which plugin causes the HTTP Error during upload media files. Maybe you recently activate a new plugin which causes the error. If yes then deactivate that plugin first.

In case, when you have no idea about which plugin is generating the error, then deactivate all plugins. If this resolve the issue then activate the plugins one by one to check which plugin creates the problem. Once you identified the plugin, then contact that particular plugin’s support team to fix the problem.

We hope this article helps you to remove HTTP error in WordPress when you trying to upload an image.

Scroll to Top