HTTP error when uploading an image via the WordPre

2019-04-08 17:23发布

Each time I try to upload an image using the WordPress Media Uploader (WP Admin > Media > Add new) the upload stalls at around 13% and I get an error message appear on screen "HTTP error".

So far I have created a php.ini file in my WordPress root with the following:

memory_limit = 256M
upload_max_filesize = 16M
post_max_size = 64M

I've also put a php.ini file in my /wp-admin/ folder (an exact duplicate of the above).

After checking with phpinfo() I can see these changes have taken effect but they have not resolved the 'HTTP error' problem I am getting.

I am using a 1and1.co.uk dedicated server (managed) so don't have root access. 1and1 have confirmed plain CGI is enabled on the server (not Fast CGI if that makes much difference?).

Why might this error be happening? Is there anything else I can do to try to resolve it?

UPDATE: I have done some testing using different browsers and different devices:

Acer Aspire One netbook

  • Chrome - problem exists
  • FireFox - problem exists
  • IE - working
  • Safari - problem exists

Acer Aspire 5552 laptop

  • Chrome - working
  • FireFox - working
  • IE - working
  • Safari - working

Google Nexus 7 tablet

  • Chrome - working
  • FireFox - working
  • IE - working
  • Safari - working

Samsung Galaxy G4 Mini

  • Chrome - working
  • FireFox - working
  • IE - working
  • Safari - working

As you can see the problem only exists in Chrome, FF and Safari on my Acer Aspire One netbook. What could be the source of this problem?

12条回答
时光不老,我们不散
2楼-- · 2019-04-08 17:38

I put the following code into my functions.php file. It works!

add_filter( 'wp_image_editors', 'change_graphic_lib' );
function change_graphic_lib($array) {
return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
}
查看更多
smile是对你的礼貌
3楼-- · 2019-04-08 17:41

Just install plugin from here https://github.com/getsource/default-to-gd, and forget the error.

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-04-08 17:41

it easy to fix. just click right button in picture, properties and than unblock picture, its on the bottom. that will work. I tried all other thinks from forums and nothing. works on windows 10

查看更多
混吃等死
5楼-- · 2019-04-08 17:42

It's a browser issue. WordPress media uploader uses JavaScript and it seems that some of the browsers you tested don't work well with such uploader.

You always have a link on add new media page to a non-javascript upload. Test that and see if the problem persists.

Updated

We commented my first idea, and it isn't a browser issue.

So, if it's something related to the backend, I guess you should start checking type and size of images. Access to server logs should help you a lot.

Using Apache, directive MaxRequestLen is always an important factor. Did you check that?

查看更多
SAY GOODBYE
6楼-- · 2019-04-08 17:43

Put below code in your activated theme's functions.php file.

If your media uploader gives HTTP error while uploading image, Try to change graphic library using below filter.

Below filter used for change the graphic library.

I hope it's help you.

add_filter( 'wp_image_editors', 'change_graphic_lib' );

function change_graphic_lib($array) {
    return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
}
查看更多
放我归山
7楼-- · 2019-04-08 17:52

I use the Hiawatha web server, and in my case, the issue was MaxRequestSize and MaxUploadSize values being set too small.

I've solved it by adding this to my /etc/hiawatha/hiawatha.conf:

Binding {
        Port = 80
        MaxRequestSize = 1000000
        MaxUploadSize = 550
}
Binding {
        Port = 443
        SSLcertFile = /etc/hiawatha/serverkey.pem
        MaxRequestSize = 1000000
        MaxUploadSize = 550
}
查看更多
登录 后发表回答