How to solve the infuriating HTTP error when uploading images or videos to WordPress

Here’s a foolproof method to fix the dreaded HTTP error seen when attempting to upload images, videos, or other accepted file types to the WordPress Media Library.

One of the most frustrating aspects of using the popular WordPress platform is running into this error when attempting to upload media. If you’ve never experienced this, you’re lucky! I run into this problem on ~1% of my image uploads and have wasted a lot of time and energy trying to resolve it.

solve HTTP error uploading WordPress
I’m not alone. The two million plus hits returned by a quick Google search for the cause of this problem make it abundantly clear that this problem is common, and that there is neither a simple explanation why it occurs nor a single solution that prevents it from happening. Here is a summary of some of the “solutions” that have been proposed:

  • Reduce image size
  • Increase PHP memory
  • Disable mod_security
  • Disable plugins
  • Change php.ini and /or .htaccess settings
  • Install a newer version of php
  • Disable image optimization
  • Change upload folder permissions

I’m not denying that these approaches work under some circumstances, and if you are consistently unable to successfully upload images to the WordPress media library you should probably investigate them. But be prepared for a lot of messing about with no guarantee of success. (At least, that was my experience.)

So, here’s a solution that works (note: except for websites hosted at wordpress.com, because plugins cannot be added to such sites).

How to avoid an HTTP error when uploading media to WordPress
Begin with these three one-time-only steps:

  1. Obtain and set up an FTP program so you can transfer files to your WordPress host. If you didn’t understand that sentence, don’t worry: here’s a beginner’s guide to obtaining an FTP program and using FTP to transfer files to and from your WordPress site.
  2. Install the Add From Server plugin and activate it. If you don’t know how to install a WordPress plugin, consult this clear beginner’s guide.
  3. From your WordPress Dashboard, check Settings > Add From Server. The default settings [User Access Control All users with the ability to upload files] & [Root Directory Do not lock browsing to a specific directory] should be fine for general use.

Once you’ve completed the above steps, you can upload media to your WordPress library as follows:

  1. Run your FTP program and navigate to the appropriate folder to upload your media. There are a couple of possibilities here. For a default WordPress installation, the appropriate folder will be your Uploads folder, i.e. (..[NameOfYourSite]/wp-content/Uploads/).
  2. If, however, you have the WordPress Dashboard Settings > Media option Organize my uploads into month- and year-based folders checked, you will probably want to upload your media into a subfolder of Uploads that has the form [CurrentFourDigitYear/CurrentTwoDigitMonth/], for example ..[NameOfYourSite]/wp-content/Uploads/2017/07/. Note that if this is your first upload for the current month, the folder won’t exist and you’ll need to create it using the FTP program.
  3. From your WordPress Dashboard, go to Media > Add From Server.
    solve HTTP error uploading WordPress
  4. Use the navigation links at the top of the Add From Server screen to navigate to the same folder you chose in step 1 or 2.solve HTTP error uploading WordPress
  5. Click the checkmark box (or boxes) next to the media you wish to add. Then scroll to the bottom of the page. There’s an option to set the imported date to the current date and time [default] or the file’s creation date and time. I think the default is most appropriate, but feel free to choose the alternative. Click the Import button and voila! Your selection(s) will be added to your WordPress Media Library!

That’s it! Although this description of the process is long, once you’ve set up your FTP program the five steps above take very little time to complete. I hope this has been helpful, and welcome your comments below!

47 thoughts on “How to solve the infuriating HTTP error when uploading images or videos to WordPress

  1. Using Add from Server option is not a viable workaround for me. When trying to add images from the server I can only select and import a single image at at time. If multiple images are selected then only the first image is imported into the media library. I noticed today that the file is there but the various sizes of the image have not been created as they normally would in WordPress.

    1. Hi Andre, thanks for your feedback!

      First of all, are you seeing the HTTP Error every time you upload images to the WordPress Media Library via the normal WordPress process? If so, you have a problem involving your specific WordPress environment and configuration, and, as I say above “if you are consistently unable to successfully upload images to the WordPress media library” you should explore the solutions proposed around the web. Given your symptoms, I’d suggest trying increasing php memory first.

      The method I describe is for folks who occasionally find one file that triggers the error. Actually, I have no problem importing a few files, and, from the plugin reviews, neither do other users of the plugin. My best guess is that your WordPress environment may have a php time limit or memory limitation that is preventing the plugin from completing a multiple file upload successfully. See this response from the plugin developer to a user who ran into a problem trying to import a large number of files: https://wordpress.org/support/topic/import-large-amount-of-images/

      1. Thanks Adrian. I came back to post what ended up working for me so that others might also try it. Neither file size nor type were the problem in my case.
        What I did was, after re-reading your solution to the problem, specifically pt 2, move all the image files into the latest month’s upload folder …./2017/10. For some reason Add From Server didn’t like me putting the files in any other folder except the latest month’s created folder. Hope this helps others. Thanks again!

        1. That’s great to know Andre; I’m glad you found an answer! And thank you for taking the time to share your solution — it could help others who experience your specific problem.

      2. One thing I found worked on another site this morning was to deactivate the WordFence plugin. In case someone else has the WordFence plugin, they might want to try that as well.

    1. Can you be more specific about your errors? Are you normally able to upload an image successfully? [If not, see my answer to Andre van der Merwe below.] What kind of errors did you get? Were you adding multiple files, or just one?

  2. I tried this after getting HTTP Error. Here’s what I see:
    0. installed the plugin
    1. put the file with ftp on server
    2. Do “Add from Server”
    3. the page waits for a while, then just refreshed blank, no confirmation
    4. the image is listed in Media Library, but with no preview
    5. looking at the FTP listing, the file is on the uploads directory, but no “supporting” files have been generated (foo-1024×768.jpg) etc.
    6. Adding the file to a gallery silently fails.

  3. I have one suggestion that might help. Try converting the problem image to a different format. e.g. from .png to .jpg or vice versa, and then repeating the upload attempt. This has occasionally solved the problem for me in the past.

    I am surprised, though, that the process described in this post didn’t work for you, since it has always (to date!) handled such annoying upload problems for me.

    I agree with you that the occasional failure of the WordPress media upload for no obvious reason is extremely irritating, and anyone who can fix this in the core source code would deserve countless thanks.

  4. I had a similar issue, but the difference was that it wasn’t all or nothing. I was able to upload files smaller than about 100KB, but nothing larger. After changing my Apache log level to debug (instead of warn), I was able to see that there was an error coming from referrer /wp-admin/upload.php which stated: “Requested content-length 175620 is larger than the configured limit of 102400”

    After a bit of searching, I discovered that my Apache2.conf file had a directive in the security model section called LimitRequestBody with a value of 102400. After commenting out this line, my problem was completely resolved. I may go back and un-comment this line and simply increase the value to something a bit more user-friendly for my purposes. The maximum value for this directive is 2147483647, which is 2GB. If you’re having the same issue as I did and don’t want to place any file size limits on your server, just comment out this line and restart Apache.

    1. Glad this worked for you Chris. This is one of those obscure fixes that apparently occasionally work. The code addition appears to change the order in which the system checks for available graphic libraries, using the GD library if available rather than the ImageMagick version. Who knows why this works for you?!

      Did you try the FTP version first? I understand that if your change works, it’s a simpler fix than going through the FTP approach. I posted my version because it seems to solve the problem for almost everyone, so it can be quicker than trying one potential “fix” after another until you find (if you ever do) something that works.

      1. Yup, your way definitely works. And I’m not one to shy away from FTP. It’s a brilliant workaround, I think.

        In my case (with GoDaddy), the functions.php solution allowed me to minimize the number of steps I needed to take in order to upload an image. Something I found very attractive.

        But again… this was my experience, and like you say, there are sooo many obscure fixes that occasionally work with this problem.

        I don’t imagine my solution will be the answer for everyone.
        Still I’m hoping it helps to broaden the array of options for people facing this problem. 🙂
        #teamwork

  5. Most times, based on my experience with this error. It is often a “Plugin compatibility issue”. Just try to disable some of the plugin(s) you might have recently installed one after the other while you check the upload process. That should fix the error, at least it has always does for me on different occasions with different themes.

    Cheers.

    1. A good suggestion of something to try, Akintayo, though the time expended and pain of having to figure out which plugin might be responsible is not an especially pleasant task, and one with no absolute guarantee of success.

  6. Unfortunately, doesn’t work for us as we have frontend uploader for customers who are supposed to be able to upload their files. The weirdest part for us is that it’s not a real error. There is nothing in the error logs and after refreshing the page we will always find the files in the uploader. Wouldn’t really effect us if it was just us, but it’s our customer who are made to believe there is an imaginary error. So very frustrating!!

      1. That’s what I thought at first but you were the first person to mention mod_security as a possibility out of any website I found in a google search for this. It makes sense if you are into tightening up your security but probably not for the many people who do not have access to their sites CPanel to disable/enable it.

  7. I just want to say that I literally tried everything to get the normal system to work. No luck. Even though your solution definitely did it – I couldn’t explain this walkaround to a customer. I did however find the final solution that fixed my problem immediately.

    adding this line to the very top of the .htaccess file:
    SetEnv MAGICK_THREAD_LIMIT 1

    Good luck!

    1. Thanks for the addition. Googling this fix, I get the impression this may help in shared hosting situations where the image upload attempt uses more CPU resources than acceptable to the hosting provider. This environment variable restricts the processing to a single CPU/thread which apparently allows the image to be processed successfully without running foul of hosting limits.

    2. savesheep, that did it for me!!! Thank you for finding this fix! Nothing was working for me either, trying to upload a monthly newsletter that was the same size and style PDF as many previous newsletters (none of which caused an upload error).

      1. Always great to hear about solutions that fix this frustrating problem under some circumstances. As mentioned in other threads, getting the HTTP error consistently implies that changing your specific server environment is something to be investigated. For those who are just getting it occasionally, the procedure I’ve described works well and avoids the time and frustration trying the many different possible solutions that people have devised.

  8. After trying and trying to fix this issue I changed both WordPress Address (URL) and Site Address (URL) in the general settings of wordpress from http to https and refreshed the image….all fixed. 🙂 No technical know how.

  9. thank you so much!!! Literally was struggling with this for hours. Once you create or find your ftp account, then you just download the ftp program, make sure to upload and activate the plugin, and lastly locate the upload folder in the program. it’s cake work from there…thanks agaiin man!

  10. This solution may helps but it didn’t help me.
    My website needed a PHP update to the (actual) latest versione (7.0.25): you can do the update by yourself or contacting your web hosting 🙂

  11. Here is what worked for me when uploading images to [my website]…
    1. Deactivate all plugins (All of Them)
    2. Upload your video files.
    3. Reactivate all plugins.

    I could have troubleshooted the site and deactivated one plugin at a time, but I didn’t have time for that. I’m sure that the offending plugin will still cause a problem in the future, but this was the fastest workaround. Hope this helps someone.

  12. what a pain in the ass and impractical.
    However this is the solution !..
    Went through all the “solutions” on a gang of different sites.. from the browser to PHP increase to all the different file channel inputs, to unplugging plugins, uninstalling themes.. Nada. Turns out it is the as of WordPress 3.5, GD has been abstracted out into WP_Image_Editor, and Imagick has been made the default image manipulation engine. IMagick being the problem for some reason. This plugin is what ended up working like a charm for me:

    “Default to GD” plugin..The plugin is at GitHub not in the WP download directory. https://github.com/getsource/default-to-gd

Leave a Reply

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