1

media_sideload_image function not working for image url with JPG extension, its working fine for jpg (http://example.com/image.jpg) and png (http://example.com/image.png) but not with JPG (http://example.com/image.JPG)

following is the error returned

[errors:WP_Error:private] => Array
        (
            [http_404] => Array
                (
                    [0] => Not Found
                )

        )

    [error_data:WP_Error:private] => Array
        (
        )
3
  • as far as i recall the filenames are case sensitive. means, if the picture is saved image.jpg it wouldnt be found as image.JPG Apr 14, 2015 at 12:12
  • file is saved with JPG and I can access with with direct url
    – Vikram
    Apr 14, 2015 at 12:14
  • Why do you want to use uppercase extensions. Extensions are lowercase. In general, you should really really try to avoid special characters and uppercase lettering in file names. Somewhere along the line this is going to backfire as it did in your case. Apr 14, 2015 at 13:03

1 Answer 1

3

You should check for the special characters in url, sometimes url structures may contain special characters like space, &, ' .

use str_repalce to replace known special characters or urlencode.

media_sideload_image works properly with JPG as well so either url contains special characters.

If you can access image through url there is not a permission issue as well which blocks image download sometimes.

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.