Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Fix the HTTP Image Upload Error in WordPress

Are you seeing the HTTP error while uploading media in WordPress? This error usually occurs when you are uploading an image or other files to WordPress using the built-in media uploader. In this article, we will show you how to easily fix the HTTP image upload error in WordPress.

How to fix http error when uploading images in WordPress

What Causes HTTP Error During Media Upload in WordPress?

There are a number of things that could lead to a HTTP error when you are trying to upload files using the WordPress media uploader. Basically, WordPress is unable to figure out the cause and that’s why it displays the generic ‘HTTP error’ message.

HTTP Error

The frustrating part is that this error message doesn’t give you any clue as to what may have caused it. This means that you will have to try different solutions to find the cause and fix the error.

That being said, let’s take a look at how to troubleshoot and fix the HTTP error during media upload in WordPress.

1. Make Sure The HTTP Error is Not Temporary

First, you should wait a few minutes and then try uploading your image file again. This error is sometimes caused by unusual traffic and low server resources, which are automatically fixed on most WordPress hosting servers.

If that doesn’t work, then you may want to try uploading a different image file. If the other file uploads successfully, then try saving your original image file to a smaller size and retry uploading.

Lastly, you may want to try saving the file to a different format. For example, change jpeg to png using an image editing software. After that, retry uploading the file.

If all these steps result in the HTTP error, then this means that the error is not caused by a temporary glitch and definitely needs your immediate attention.

2. Increase WordPress Memory Limit

The most common cause of this error is lack of memory available for WordPress to use. To fix this, you need to increase the amount of memory PHP can use on your server.

You can do this by adding the following code to your wp-config.php file.

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

This code increases the WordPress memory limit to 256MB, which would be enough to fix any memory limit issues.

File uploaded successfully

3. Change Image Editor Library Used by WordPress

WordPress runs on PHP which uses two modules to handle images. These modules are called GD Library and Imagick. WordPress may use either one of them depending on which one is available.

However, Imagick is known to often run into memory issues causing the http error during image uploads. To fix this, you can make the GD Library your default image editor.

You can do this by simply adding this code to your theme’s functions.php file or a site-specific plugin.

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

After adding this code, you can retry uploading files using the media uploader. If this doesn’t solve the issue, then you can remove this code and try other methods described in this article.

4. Using The .htaccess Method

This method allows you to control how Imagick uses server resources. Many shared hosting providers limit Imagick’s ability to use multiple threads for faster image processing. However, this would result in you seeing the http error when uploading images.

An easy fix is be to add the following code in your .htaccess file:

SetEnv MAGICK_THREAD_LIMIT 1

This code simply limits Imagick to use a single thread to process images.

We hope this article helped you fix the HTTP error during media upload in WordPress. You may also want to see our WordPress troubleshooting guide as well as the ultimate list of most common WordPress errors and how to fix them.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

174 CommentsLeave a Reply

  1. FANTASTIC!!! Every other search I did yielded nothing.

    Godaddy hosting with wordpress installed. Killing imagick did the trick. My lightroom plugin is functioning like a trooper now.

    Thank you so much, just had to share with you.

  2. Hi,
    I started having this HTTP uploading error for images that are larger than 600x900px . The size in KB doesn’t matter – 100KB or 300KB – they are uploading just fine if they are less then 600×900.

    I have tried all the methods you described without success.

    Do you think that changing the theme can help?

    • You would first want to reach out to your hosting provider to ensure you are not running into a safety measure from their end that would cause the error.

      Admin

      • Thanks!
        I called them before posting my question – they told me to contact WP support. To me, it also looks like they installed something on their server but are not willing to admit it.
        I’ll call again.

  3. The functions.php method worked for me. I’ve been trying to fix that for months! You saved me a lot of time. Thank you!!!

    • You would likely need to reach out to your hosting provider and they should be able to help solve the issue

      Admin

  4. Tried all the above and no luck. My issue is only mp3 files, I get the http error. Contacted my hosting provider and they could find nothing wrong. Images upload fine. What am I missing?

    • For MP3 files you may need to increase the memory limit to 512 in case it is due to how large the files are

      Admin

  5. Number 3 worked for me! Thank-you so much, that was so frustrating before. You’re site is always so helpful :)

  6. Thank you so much, I went through all four steps but nothing worked. I went back to step 1 and increased it from 256mb to 512mb which solved the problem.

    • Glad our guide could help be a part of the solution and you were able to get it resolved :)

      Admin

  7. Option #3 worked for me to resolve the HTTP error.

    I installed the code snippets plugin and copied the code from here. It worked perfectly the first attempt.

    Thank you!

  8. Also just check the name of your image you want to upload.
    Make it simple as this has done the trick for me on multiple occasions.

    • Have you reached out to your hosting provider to see if there are any errors on their end?

      Admin

  9. None worked above and then we realize our dev site needed to change the Home and Site URL in General Settings in WP Admin from http:// to https:// then it worked! :D

  10. None of these worked in my case. Mod security was the cause. I had to temporarily disable mod security on my web server.

    • Thanks for sharing what worked for you if other users run into this problem. For most users, they will need to reach our to their hosting provider for assistance in editing mod security

      Admin

  11. SOLVED: my pdf files that would not upload into the Word Press media library with HTTP Error had file names with a semi-colon in them. I deleted the semi-colon and it uploaded just fine. Semi-colons are legal characters in Word docs and pdf files, but apparently won’t upload to Word Press for reasons beyond my knowledge. ; ; ; ;

    • Thanks for sharing that solution for anyone else running into that problem :)

      Admin

    • If none of these methods worked, have you tried reaching out to your hosting provider to see if they can see an error on their end?

      Admin

  12. Method #4 worked for me. It seems my host was limiting the plugins processing power. Thanks for sharing these solutions.

  13. Another common problem for this is that you used an apostrophe in the file name. I just encountered this problem :)

  14. I have tried all the methods as mentioned above but none of these worked for me. So I contacted the service provider. They resolve the issue.
    They have refreshed and whitelist another IP for me and it works.
    Hope this may help for you too.

    • Have you reached out to your hosting provider to ensure they don’t see any errors on their end?

      Admin

  15. don’t need to follow all step you just need to re-login your website and clear your temp files, that ok

    • For some people maybe, for others, they do require all of the steps in the article. :)

      Admin

  16. I tried Option 3. Now my entire home page is blank. Individual pages are still there. The Sidebar is still visible, but the rest of the home page is blank.

    Please help if possible.

    Thank you,
    Sandy

    • You may want to ensure you didn’t change your homepage settings while troubleshooting and have you removed the code to see if that solved the missing content?

      Admin

  17. Worked like charm Option 3.

    While My wordpress admin panel is slow.. Working on it. Any guide?

    • You may want to try disabling your plugins to see if one of your plugins could be slowing the admin area.

      Admin

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.