
In case you have been using WordPress for long enough, you must have encountered a common issue while uploading image files.
Technically, this error might occur due to different reasons, but WordPress just presents you with a HTTP error.

So, basically you have to understand the reason why your image file is not getting uploaded and then only will you be able to fix the issue.
Contents
Why does this error occur?
Although WordPress is not really able to parse this error and tell you the exact reason why this error occurs, there are some certain reasons which might cause this problem.
In most cases, this problem turns out to be pretty much temporary. Due to lack of server resource or unusual traffic, you might face some errors while working with the WordPress Image Uploader.

Another problem might be the amount of memory allocated for the server, the size of the file that you wish to upload, the file extension of the file, and you can even face issues with the file access on your server.
Problem and its solution
Check for Temporary Errors
Before you go ahead and try out different solutions, the first thing you need to do is check whether the error shown on your WordPress is not temporary.
Although this cannot help you in specifying the reason of the http error but you can get going with the problem solving methods.
In case you are having a problem with your image file extension or file size, modifying the file extension or getting a file with smaller size will solve the problem.
In case the problem persists, you need to go for other methods.
WordPress Memory

Another common reason why you might be facing an http error is the insufficient memory for WordPress.
As you can understand, without having proper resources, it might become a
headache to get going with the file upload without any error.
You can define the WordPress memory size in the wp-config file on your server. This will allow your server to allocate enough resources for WordPress to run smoothly.
Image Library

WordPress deals with 2 different image uploading libraries known as Imagick and GD library.
In most cases WordPress, by default, choose to go with Imagick but as it turns out this image library is known for its http errors while uploading a file and this is the reason why you need to change it to GD library.
To do so, you will need to add a snippet of code to your function.php file and it should do the trick.
function bhad_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', 'bhad_image_editor_default_to_gd' );
In case you are facing similar problem even after changing your image library, you might have to go for other methods of solving image upload issues.
Folder/File permission

Another common reason that may cause this problem is the file or folder permission on your server.
To check whether there is a problem with the file permission on your server, you need to logon to your server or use a FTP account to view your files and folders on the server.
Under the public_html folder you can find wp-content. Under that folder find Uploads folder and check the file permission.
Right click on it; go to ‘File permission’, then tick mark ‘Recurse into subdirectories’ and select ‘apply to all files and directories’. Now click ‘OK’ and save the file permission.

Now check with the WordPress image library, it should be fine with all the uploaded images.

At times, installing plugins might create problems in uploading files on WordPress.
Using old version of plugins or errors in the plugin code might trigger the error.
The only way to know the problem with your plugins will be to start disabling each and every plugin one by one and check whether the uploading error is gone or not.
In case you are using a plugin to assist your uploading work, you need to check that plugin as well.
Until you find out a particular plugin that is creating the problem, you have to keep doing this.
Image Size / type

Sometimes it might so happen that a particular file is really large.
In this kind of situation, if you get an html error while uploading, it is really wise to either choose a photo with lower resolution or file size or you can try and reduce the file size so that it gets uploaded on your WordPress.
Make sure to check with the other file sizes that you already uploaded before in order to have an idea about what kind of file size might allow you to upload that specific file.
In some cases, changing the file extension might help as well.
MOD security

You must have seen a security file residing in your WordPress directory.
Well, in case you haven’t seen it before, you need to know about this file now.
In case the file is enabled on your server, you will need to add some specific codes to ensure that your WordPress does not produce any error while uploading an image file.
For this you need to add .htaccess file to your wp-admin folder and add the necessary codes to grant access of other folders to your WordPress image uploader.
Once done, you should not face any issues with image uploading.
Php Version
The problem with php version might arise if you update your plugins and WordPress versions pretty much frequently.
In this kind of situation, if you do not update your server php version, then you might have to face this kind of issue with image file upload.
Rename your image file

In case none of the above techniques work, you can try this method as a last resort. Just try to re-upload your file after you rename the file.
This trick might work in case the file name comprises of multiple symbols.
So, that is all that you need to know to get rid of html errors while uploading images to WordPress.
In case you face such problems one of these above methods will surely help you out and you will be able to keep uploading files on your WordPress without any problem at all.
I was facing same issue, thanks for sharing in simple way.
You are welcome 🙂