1

I've noticed several articles about how to deal with the HTTP error when uploading images to the WP Media library:

How to Fix HTTP Error When Uploading Images?

However, I've already tried adding this code to the functions.php file:

add_filter( 'wp_image_editors', 'change_graphic_lib' );

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

(As was suggested by the most upvoted answer in that article)

And I've also tried some of the things that were suggested in the accepted answer of that article, such as adding define('WP_MEMORY_LIMIT', '256MB'); to the wp-config.php file, and adding the following codes to the .htaccess file:

  1. AddType x-mapp-php5 .php

  2. <IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule>

  3. # Exclude the file upload and WP CRON scripts from authentication <FilesMatch "(async-upload\.php|wp-cron\.php|xmlrpc\.php)$"> Satisfy Any Order allow,deny Allow from all Deny from none </FilesMatch>

But still the HTTP error remains.

I admit - I haven't yet tried the suggestions in this article (25 Image Media Uploader Problems – WordPress), but before I do, I also heard that I should try resetting the ownership and permissions of the wp-content folder. And I would like to try that first.

So, what does it mean to reset the ownership and permissions of this folder? Would I simply need to follow the instructions in this article (How to Fix File and Folder Permissions Error in WordPress)?

The article suggests changing the folder permissions to 755 (my folders already have this permission)

enter image description here

And the file permissions to 644.

enter image description here

But I'm nervous about doing this. I don't want to make any changes that can't be undone and I'm not even sure if this is what's meant by resetting ownership and permissions of the wp-content folder.

Please advise as to whether or not this is the best way of "resetting the ownership and permissions of the wp-content folder", and if you think it will help to eliminate the HTTP error when uploading images to the WordPress media library.

Thanks.

EDIT: Screenshots of HTTP error:

enter image description here

enter image description here

EDIT 2: I have noticed that images with smaller file sizes are able to upload without error. I.e. an image of 578 KB will upload but an image of 610 KB or above will not.

EDIT 3: Setting the permissions of the folders in the root directory to 755 and the permissions of the files in the root folder to 644 as is suggested in the article How to Fix File and Folder Permissions Error in WordPress did not work. The HTTP error when uploading files remains:

enter image description here

I also tried calling my hosting company, and they upgraded PHP to version 7.1 for this website, but the error still remains.

  • 1
    What error do you get? Check file permissions for wp-content/uploads (and subdirectories), not just the root level files. Setting them to 755 (dirs) and 644 (files) won't break anything, you can safely do that. Just make sure to check the "recurse into subdirectories" checkbox – kero Jan 5 at 16:59
  • I added screenshots of the HTTP error. I have started the first step - setting the directories to 755 with "recurse into subdirectories" checked. And I will set the files to 644 once this is complete. Changing the permissions currently looks like this in FTP: i.imgur.com/MTWH72B.png – HappyHands31 Jan 5 at 17:19
  • 1
    This error just appeared, right? You could upload images before? I would probably contact the host, it might either be a change in PHP config or something such as no available space left – kero Jan 5 at 17:43
  • That is correct - it wasn't happening earlier. Sure - will contact them. – HappyHands31 Jan 5 at 17:46
  • Just for the record, the hosting company upgraded PHP to version 7.1 for this website (that was their only idea), but the error still remains. – HappyHands31 Jan 5 at 18:07
2

try increasing WordPress Memory Limit to 256M 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.

If you still face the same issue then try this code. paste this code in the functions.php file of your active theme.

function wp_image_uploading( $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', 'wp_image_uploading' );

Also, Try adding this code in your .htaccess file.

SetEnv MAGICK_THREAD_LIMIT 1

Verify your file and folder permissions.

  • Wow, it was your second suggestion, specifically the line add_filter( 'wp_image_editors', 'wp_image_uploading' ); that fixed the problem. What I had before was add_filter( 'wp_image_editors', 'wpb_image_editor_default_to_gd' ); And changing that to add_filter( 'wp_image_editors', 'wp_image_uploading' ); is allowing me to upload images to the media library again. The rest of my code was the same as in your answer. I'm not sure what it is about 'wpb_image_editor_default_to_gd' );, specifically, that fixed the problem. Do you know? Thanks! – HappyHands31 Jan 6 at 2:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.