fbpx

The WordPress HTTP error is one of the common errors that you are likely to encounter if your website is running on WordPress. This error turns out to be quite frustrating since there is no actual reason as to why it occurs.

Within this article, we will look into what this error is all about as well as some of the fixes that you can apply in order to resolve the error.

Table Of Contents

What is the WordPress HTTP error when uploading media

How To Fix the the HTTP Error

Conclusion

What is the WordPress HTTP error When Uploading Images

The WordPress HTTP error is a general error that is generated upon trying to upload media items via the media uploader. These media items can either be videos or images. For example you can encounter this error when uploading a featured image of a post.

HTTP errors usually contain a status code. This status code enables you to determine the cause of the error. However, the frustrating thing with this error is that WordPress is not in a position to determine the exact cause of the error.

Using images within your website is quite vital as images provide additional information in a much better format. Images also provide an SEO advantage when it comes to indexing your website in search engines. It is hence important to fix such a HTTP error in order to be in a position to upload images or rather media within your website.

This error can be caused by a number of issues. Some of these include:

i) Wrong File Name: If the image file name contains special characters, when uploading such images, you are likely to encounter the HTTP error.

ii) Theme and Plugin Issues: A plugin or theme might contain a function that hinders the upload of media items within your website.

iv) Memory Limit: If the WordPress memory limit in your website is quite low, then you are also likely to encounter the HTTP error.

v) Image Editor Modules: Resource limitation in modules such as ImageMagick could also lead to the HTTP error.

How To Fix The HTTP Error

In order to fix the HTTP error, you may need to try out a number of solutions depending on your site setup. This would enable you identify the cause of the issue as well as apply the appropriate fix. The process may take some time depending on how fast you are in a position to determine the cause of the error, but it is definitely worth it.

Should the error be resolved by applying a specific solution, you don’t necessarily need to carry out the other solutions.

We will cover some of the suggested solutions that you can try out within this guide.

Carry out Checks and changes to determine if the Issue is Temporary

A number of checks and changes can be carried out to determine if the HTTP error issue is temporary. Some of these checks and changes include:

i) Refreshing your browser: At times a loss of internet connection can cause images not to be uploaded to your website. It would hence be necessary for you to first refresh your web browser and check whether this could be the case in your end.

Still within your browser, you can also clear your browser cache and check whether the issue is resolved. Alternatively, you can also test whether the issue is replicated in a different browser where you have not tested the site or in incognito mode.

ii) File size checks: If your image or rather media item is too large, then you are also likely to encounter the HTTP error. You may hence try to first resize your image and ensure that it does not exceed your WordPress Maximum upload size. In addition, you can also optimize your images using an image optimization plugin of your preference. Some examples of such plugins are EWWW Image Optimizer and Imagify.

iii) Change the file type: Some servers may not support various image formats. In such cases, if you upload a non-supported file type, you could encounter the HTTP error. To ensure that this is not the case in your end, you need to change the file type of your image or rather media item. Once this is done, re-upload it under the new file type and see whether the issue is resolved.

Rename the Image File Name

The images that you upload using the WordPress media uploader should not contain special characters. Some of these character include apostrophes, colons, equal signs, semi colons and international language symbols. Characters such as dashes and underscores are however safe to use.

In order to check whether this could be the issue on your end, you hence need to check whether either of the above mentioned characters are present within your image file name. If so, remove them from the file name and try uploading the image once again.

Temporarily Deactivating Plugins And Themes

At times, the HTTP error could be caused by plugins that you have in place. Security plugins and image optimization plugins are usually the likely causes to the error.

In order to eliminate the possibility of the error being caused by a plugin, you will need to bulk-deactivate the plugins that you have in place. This can be achieved from the plugins’ section within your WordPress dashboard as illustrated below:

Upon deactivating the plugins, upload your image once again and check whether the issue is resolved. If so, reactivate the plugins one by one and upload the image in every plugin activation instance in order to identify the culprit plugin.

At other times the HTTP error is caused by the WordPress theme in use. This is however a rare case scenario since themes do not directly affect media upload within a WordPress website.

In order to however eliminate the possibilities of a WordPress theme being the cause of the issue, you can switch to a default WordPress theme such as the Twenty Twenty-One theme or Twenty Twenty Two theme. Upon carrying out the switch, upload your image and check whether the HTTP error is rendered. If not, then it means that the issue is being caused by the theme you were originally using.

In either of the cases above, if you happen to narrow down on the issue being caused by a plugin or a theme, it is advisable to contact the respective product author(s). Else, you can opt to use an alternative plugin or theme.

Modify WordPress Image Libraries

WordPress uses two PHP modules to process images. These are Imagick and the GD Library. WordPress will by default use one of the modules, depending on your server installation.

The Imagick PHP module however does at times exhaust assigned resources such as the memory limit. In a case where there is exhaustion of the memory limit and you try to upload an image to the website, you are likely to encounter the HTTP error.

In the above case, it would be appropriate to switch to the default GD Library. In order to implement this, you would need to add the code below to the functions.php file of your theme:

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');

Below is a sample screenshot illustration on this:

Once this is done, try uploading the image once again. If the HTTP error still occurs, remove the code and try out the other steps outlined within this article.

Disable mod_security

Mod_security is an Apache module that acts as open source web application firewall. When enabled it may at times cause the HTTP error upon trying to upload images within your website.

In order to test whether the issue is being caused by the module, you can have it disabled first. This is easily achievable from your .htaccess file.

First, you would need to access your root site files via FTP using a software such as Filezilla. Alternatively, you can do so via your hosting panel.

Next, select to edit the .htaccess file and add the following code to the top of the file:

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

If your host uses cPanel, you can instead disable the ModSecurity module. The module is located within the “Security” section.

Upon tracing the module, click on it and disable it within your domain by setting the status to “Off”. Below is sample screenshot on this:

Upon carrying this out, try uploading your image once again and check whether the issue is resolved.

Permissions Check On the Uploads Folder

WordPress recommends using the 755 permission mode for directories. At times if this is not the case, you are likely to encounter errors such as the HTTP error in discussion here. It is hence important to counter-check if the image upload error is due to the permissions within the uploads folder.

The uploads folder is located within the Wp-content directory of your site files. You can easily locate the folder via FTP or a hosting panel such as Cpanel.

Upon tracing the folder, check whether the permissions match 755.

If not, have the permissions manually changed to 755.

Once this is done, try re-uploading the image and check whether the HTTP error is now resolved.

Increase the PHP Memory Limit

In cases where the memory limit is exceeded when uploading image or media items, you are also likely to encounter the HTTP error. This is because the server does not contain sufficient memory in order to complete the image/media upload. You will need to hence increase your PHP memory limit.

In order to increase the memory limit, this can be achieved by adding a single line of code within your wp-config.php file. The wp-config.php file is located within the root of your site files. You can as well access it via FTP using a software such as Filezilla. Alternatively, you can do so via your hosting panel.

Upon tracing the file, select to edit it and add the code below:

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

The code should be added just before the line that reads:

/* That’s all, stop editing! Happy publishing. */

Below is a screenshot illustration on this:

Once this is done save your changes and try uploading your image/media item once again to see whether the issue is resolved.

Update Your PHP Version

WordPress recommends usage of the latest supported PHP version within your site. Using an outdated PHP version is a likely cause of HTTP errors. If your PHP version is outdated you will have a notice on this within your WordPress dashboard. Below is a sample illustration on this notice:

As it currently stands WordPress fully supports PHP version 7.4 as per its requirements here. It is hence recommendable that you use this version as it currently stands. You can ask your hosting provider to update your PHP version for you.

If your host uses cPanel, you can easily change your PHP version from the “MultiPHP Manager” or “Select PHP Version” link depending on your host configuration.

You can then apply the up to date PHP version to your domain as illustrated below:

Once this is done, try uploading the image/media once again and check whether the issue is resolved.

Conclusion

Despite the fact that the HTTP error does not have a specific reason for its occurrence, it is still possible to troubleshoot and fix the error. Within this article, we have covered at least eight methods that you can use to troubleshoot and fix the error within your website.

Our hope is that at least one of the approaches discussed above gets to help you in fixing the HTTP error within your website. Should you have any questions or new suggestions on this, please feel free to leave a comment within the comment section below.

Comments to: How To Fix The WordPress HTTP Error When Uploading Images

Your email address will not be published. Required fields are marked *