Make WordPress Core

Ticket #12518: mimetype.patch

File mimetype.patch, 630 bytes (added by jonquark, 15 years ago)

If not supplied, determine mime-type for uploaded images

  • xmlrpc.php

     
    28072807                        logIO('O', '(MW) ' . $errorString);
    28082808                        return new IXR_Error(500, $errorString);
    28092809                }
     2810
     2811                //if we don't know the type of the file, try to figure it out...
     2812                //...at least for the common case of image uploads
     2813                if(!isset($type) || $type == '') {
     2814                        $sizedata = getimagesize($upload[ 'url' ]);
     2815                       
     2816                        if($sizedata != FALSE) {
     2817                                $type = $sizedata['mime'];
     2818                        }
     2819                }
     2820
    28102821                // Construct the attachment array
    28112822                // attach to post_id 0
    28122823                $post_id = 0;