A client reported to me that he was experiencing problems uploading files into his photo gallery. He indicated that he was receiving “HTTP Errors” during the upload process. It was also mentioned that the error was inconsistent. Sometimes the files would upload properly, sometimes they would not.

HTTP Error Testing

To verify the HTTP Error, I tested the website by uploading image files using the media library multi-loader interface. Image files of various sizes were used for testing. File size ranged from 100K to 5M. There were errors during the upload process. When either using the drag-and-drop method or the file select method, the files would begin to upload and as soon as the process appeared to reach 100%, the HTTP Error would display.

The images that uploaded normally, the process would complete and a thumbnail of the image would be displayed in the media library. For the images where the upload process failed, the images would be listed in the media library, but the thumbnail would not be of the image. The thumbnail would be a document icon. So it was readily apparent that the upload failed.

What is also interesting is that when uploading multiple image files, some of the images would upload properly and some images would not. There were mixed results in each image upload batch.

With single images and with batch image uploads, upload success was inconsistent. It did appear that smaller files had a better success rate than larger files, but there were failures across all sizes of images.

What is even more interesting is that the files that failed to upload appeared in the upload folder. For this install, uploads are sorted by month.

HTTP Error Diagnosis

To diagnose the source of the HTTP Error, I started with the standard procedures: updated themes, updated plugins, changed themes to a default theme, disabled plugins, etc. The HTTP error continued to present itself on an intermittent basis. None of these procedures were successful.

  • Reinstalled WordPress 4.8.2. No change.
  • Checked hosting configuration. Using latest version of PHP.
  • Checked php.ini file. No issues found

HTTP Error Resolution

Researched various solutions for resolving the HTTP Error. Since this was a standard WordPress install and a very simple installation, the signs pointed me towards a server issue or a server configuration issue. I tested a couple recommended changes with no success. There was either no change or the suggestion caused my WordPress server to fail.

The suggestion that worked was found on the WordPress Trac site.

Added the following code to the functions.php of the theme.

add_filter( 'wp_image_editors', 'change_graphic_lib' );

function change_graphic_lib($array) {
return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );

Source of the resolution is located at https://core.trac.wordpress.org/ticket/36534#comment:25

After adding the above code to the functions.php file. I was able to upload files of various sizes without issue. Tested up to 6MB files.

To confirm solution, I remarked the code in the functions.php file and tested uploads again. The HTTP Error returned after the code was remarked.







Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have successfully subscribed!