[SOLVED] WordPress Gives A HTTP Error When Uploading Images To The Media Gallery

If you’ve been around my blog for long, you know I am a bit of a WordPress fanboy. It’s my favorite CMS and blogging platform, primarily because of the fact that the community of developers who make themes and plugins for WordPress are amazing. I’ve been working with WordPress for more than 10 years now, and it never ceases to amaze me what amazing solutions have been developed in the form of plugins.

That doesn’t mean that WordPress is perfect, though. Sometimes, the open source nature of the CMS can introduce bugs or incompatibilities that can cause errors or even bring an entire site down. If you’re going to work with WordPress, knowing how to troubleshoot and solve those issues are a good skill to have.

Today’s post is one that is written to help folks who are running into the infamous “HTTP Error” error that displays when you try to upload an image to the WordPress image gallery or media gallery. If you found this post, you were probably searching Google for a term like:

  • HTTP error from WordPress when uploading an image
  • Why is WordPress giving me a HTTP error?
  • Troubleshoot HTTP error in WordPress
  • Why won’t WordPress let me upload my image? It’s giving me a HTTP error.

In my experience, there are two situations where WordPress might throw an HTTP error when uploading images. The first, is session-based and the second is configuration-based.  Session-based issues are quicker to fix, while configuration-based require a little more tech knowledge (but are still pretty easy to fix). Below are the recommended solutions for both scenarios.

Scenario 1 – A Session-Based HTTP error from WordPress

Here’s the situation. You are in the middle of writing a blog post. You took a break for a while and now, when you come back to work on your post, every time you try to upload an image to the WordPress image gallery, you get the HTTP error message shown in the image below.

WordPress shows a HTTP error when you try to upload an image to the media gallery

Well…that’s not really helpful, WordPress. What does an HTTP error mean? How to I troubleshoot it? What steps can I take to resolve it? Unfortunately, the error doesn’t really provide any troubleshooting tips. No worries, this one is an easy one to tackle. More than likely, what happened is your WordPress session timed out. Usually, WordPress will display a login box to let you know that you need to log back in to continue the session, but sometime that just doesn’t happen.

So, in this scenario, here are the steps to take:

  1. Before you do anything click that “Save Draft” button. Even if the session is timed out, it’s worth having WordPress try to commit any changes you have made to the database. If the session is truly timed out on the WordPress CMS, then it should take you to a login screen and it should attempt to save the changes in the background once you log in. It’s not guaranteed that your changes will be saved, but it’s worth trying.
  2. With your changes saved, close your browser.
  3. Open your browser again and log in to your WordPress console.
  4. Edit the post you were working on and try adding the image again.
  5. At this point, the browser session is new, the WordPress session is new, and the connection to your server is new. You should be able to upload your images now with no issues.

Scenario 2 – Configuration-Based HTTP errors from WordPress

Configuration-based errors usually occur when you’re first setting up WordPress and they usually are caused by the way your server is configured. The good news is for most hosts they are easy to fix.

NOTE: If you’re host doesn’t allow you to modify your .htaccess file, then you won’t be able to fix this one yourself. You’ll need to open a ticket with your host and have them fix the issue. My $.02 on this is that if a host doesn’t give you access to your .htaccess file, you should find a new host. Working with the WordPress.org version of WordPress will require you to have full access to all your files, so consider moving to a host like SiteGround <–This is my Affiliate Link)

To fix a configuration-based HTTP error, perform the following steps:

  1. Login to your host, either via their control panel (like cPanel) or via FTPIf you aren’t using FTP with WordPress, you should take some time to learn about FTP, set up your accounts with your host, and download a good FTP tool like FileZilla (which is free). Troubleshooting WordPress is a lot easier to do when you know how to use FTP.
  2. If you are logged in via cPanel, open the File Manager
  3. Locate the .htaccess file and download a copy to your local computer
  4. Open the .htaccess file with a code editor like Notepad++.
    NOTE: It is important that you use a code editor like Notepad++ NOT a text editor like Notepad or MS Word. If you use a text editor, you run the risk that your file will be encoded improperly, so use Notepad++…it’s free.
  5. Next, create a new line at the top of your .htaccess file and add the following snippet of code on that first line:SetEnv MAGICK_THREAD_LIMIT 1
  6. Save the file.
  7. On your server, via FTP or via the File Manager, rename your current .htaccess file to .htaccess-good. This basically creates a backup copy of your .htaccess that you can revert to if something goes wrong.
  8. Upload the modified .htaccess file from your local computer to your server. Be sure you place it in the same directory as the .htaccess-good file.
  9. Test your site to make sure it loads up okay by refreshing your home page. If you get an error or the site doesn’t load, rename your changed .htaccess file to .htaccess-bad, then rename .htaccess-good back to .htaccess. Your site should load up just fine again. Take some time to repeat the steps again and only later the file by adding the code above on the first line.
  10. If your homepage loads up just fine, then log out of your WordPress admin console and then log back in.
  11. Try uploading your image now. It should work just fine.

BONUS: One more thing to try if neither of the solutions above work. If you neither of the solutions work, try doing the following:

  1. Open your image in a free image editing tool like Paint.NET. NOT Microsoft Paint. Paint. NET is a great free image editor.
  2. Save the image to a different format by choosing File –> Save As and selecting a different format.
  3. If the original file that wouldn’t upload was a .jpg, then save the file as a .png. If it was originally a .png, save it as a .jpg.
  4. Try uploading the file now. Sometimes, the file encryption gets a little scrambled and saving it as a different file format can solve the issue.

I hope that helps some folks troubleshoot those nebulous HTTP errors in WordPress. Have another way of fixing the HTTP error? Be sure to share it in a comment!


Read previous post:
Disable Facebook Messenger Notification Pop-Ups With These Steps
[SOLVED] Getting Rid Of Those Annoying Facebook Messenger Pop-Ups On The Desktop Site

There is a way to stop Facebook from playing "pop-up video" with Messenger notifications. This post shows you how!