• I’ve recently released a few sites which allow users to upload images when they post.

    An interesting bug cropped up regarding file extensions, specifically the “.JPEG” extension.

    When someone would upload a file, as an example, call it “example.jpg” and it would create all the thumbnails required. When someone else tried posting with a file with the same name but the extension is “.jpeg” (example.jpeg), it would try to overwrite the old files, throw an error or only partially create new thumbnails using the new image.

    Obviously this couldn’t do, although my work around for this bug was exceptionally simple and works quiet well when I tested it on my various sites.

    Simple add:
    "$filename = str_replace('.jpeg', '.jpg', $filename);"
    just above this line:
    "$filename = sanitize_file_name($filename);"
    that is found in wp_unique_filename() function (/wp-includes/functions.php).

    I would like to see this bug fix added to the core WordPress release if at all possible

The topic ‘Image Uploads [and fix]’ is closed to new replies.