Fixing HTTP Error When Uploading Images in WordPress

This is a popular error of WordPress which occurs during the uploading period of the image. You will lose a lot of your time and energy trying to fix this error. Since there is no particular or fixed cause that can cause the error, so there is no single solution to this problem. You may have to test various causes and run through many solutions for fixing HTTP error when uploading images in WordPress. In this article, we will discuss some methods for fixing HTTP error when uploading images in WordPress.

Fixing HTTP Error When Uploading Images to WordPress

There are many reasons that can cause the error. Let’s take a look at some of the major causes that might have caused the error.

  • Trying to upload the image which is too large for your server.
  • Non-compatible Plugins,
  • Misconfiguration in wp-config.php file
  • Low server memory and poorly configured shared hosting environment
  • Insufficient memory limits
  • Mod_security
  • Incorrect file permission

Let’s see the solutions that can help us with fixing HTTP error when uploading images in WordPress.

1. Reduce image size before uploading

While uploading larger size images users can encounter the HTTP error. This error occurs because WordPress has a size limit for uploading images. By default, the maximum upload file size is 2 MB. You can minimize your file size using tools like Tinypng. Uploading images of size within the size limit of WordPress should solve this problem.

 tinypng- Fixing HTTP Error When Uploading Images in WordPress

2. Changing the media size in Media settings

If you want to upload larger size images and other media files then you may need to change the default setting of WordPress. You can add a piece of code to either your theme function file, htaccess file or php.ini file.

  • Theme function file

Find the functions.php file in your themes root folder and add the following code. Don’t forget to save the file. Any mistake in the functions.php can cause more errors so you will have to be very careful while adding the code.

@ini_set( 'upload_max_size' , '64M' );

@ini_set( 'post_max_size', '64M');

@ini_set( 'max_execution_time', '300' );
  • Create or edit the PHP.ini file

If the first function file method did not work for you then you can try this method. In your themes, root folder finds the php.ini file and add the following code. If you do not have the php.ini then you can create it and save the file by adding these codes.

upload_max_filesize = 64M

post_max_size = 64M

max_execution_time = 30
  • htaccess Method

Htaccess file is another useful file in your theme. If none of the above-mentioned methods increased your image upload size then you can use this final method. You can create or edit your htaccess file from the root folder of your theme. Simply add the following code and save the file.

php_value upload_max_filesize 64M

php_value post_max_size 64M

php_value max_execution_time 300

php_value max_input_time 300

3. Increase PHP Memory

Another solution which you can try to get rid of HTTP error and other kinds of future error is to increase the PHP memory. You can contact your web hosting company and kindly request them to increase your PHP memory limit. If you like to try it yourself then here is a way to do so.

You can add the following code to your wp-config.php.

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

Alternative way is to add the following code to your .htaccess file

php_value memory_limit 256M

The final way is to add the following code to PHP.ini file.

memory_limit = 256M

Feel free to use the size according to your requirement. If you get any kind of 500 internal server errors then that means your hosting does not allow to increase PHP Memory.

Also Read:   How to Enable Coming Soon Page and Maintenance Mode for WordPress Website

4. Disable Mod_Security

ModSecurity is some kind of web application firewall. If your server has ModSecurity enabled then this too can cause an error during the image upload. You can check if ModSecurity is causing the error by disabling the ModSecurity feature. Use this code in your htaccess file to disable the ModSecurity.

<IfModule mod_security.c> 
SecFilterEngine Off 
SecFilterScanPOST Off 

Once you have disabled the mod_security feature from your website, check if the problem during image upload was solved. Remove this code if the error was not solved.

5. Disable image optimization plugin

If you have any image optimization plugin installed in your WordPress, then start by disabling it. You can reinstall the plugin anytime from WordPress plugin directory. To uninstall the plugin without any trouble, please check our guide on “How to Uninstall WordPress Plugin in Proper Way.

image optimizaton

6. Disable all plugins and change theme

You have many plugins on a WordPress website. Disable all the plugins that you have installed. Plugins which are not updated for a long time and which are of unknown origins can cause trouble. If any of your plugins were creating the error then this should solve your problem.

disable plugin- Fixing HTTP Error When Uploading Images in WordPress

Sometimes your theme may be causing this problem too so check by changing the theme for a while.

7. Changing permissions of you sites upload folder

Incorrect file permission for the WordPress upload folder is another major cause of this error. All the images and videos you upload in WordPress is stored in the uploads folder of the wp-content directory. If you have incorrectly configured the file permission in that uploads folder then you will encounter the error. Sometimes the updates and changes undertaken by your hosting company can also cause this error. You can contact your hosting company to correct the file permission or you can do it manually using FTP client. Here is a guide on how to manually change file permission of uploads folder.

We hope this article helped you in fixing HTTP error when uploading images in WordPress. You can also read our other article on

“What is 404 Error in WordPress“.

The following two tabs change content below.
Kantiman Bajracharya

Kantiman Bajracharya

Kantiman Bajracharya is a freelance web developer. He is a computer geek who has a Bachelor’s degree in Computer Engineering. He has earned lots of satisfied customers while working for numerous successful projects. He is also a WordPress theme creator and web article writer. On free time he likes reading philosophy books, traveling and playing chess.

Share This Post