Make WordPress Core

Ticket #9081: 9081.patch

File 9081.patch, 822 bytes (added by hakre, 16 years ago)

title should be the name (related to the filename of the upload) and not the newfilename (The one in fs then)

  • wp-admin/includes/media.php

     
    189189                        $time = $post->post_date;
    190190        }
    191191
     192        $name = $_FILES[$file_id]['name'];     
    192193        $file = wp_handle_upload($_FILES[$file_id], $overrides, $time);
    193194
    194195        if ( isset($file['error']) )
    195196                return new WP_Error( 'upload_error', $file['error'] );
     197               
     198        $name_parts = pathinfo($name);
     199        $name = substr($name_parts['basename'], 0, -strlen($name_parts['extension']+1));
    196200
    197201        $url = $file['url'];
    198202        $type = $file['type'];
    199203        $file = $file['file'];
    200         $title = preg_replace('/\.[^.]+$/', '', basename($file));
     204        $title = $name;
    201205        $content = '';
    202206
    203207        // use image exif/iptc data for title and caption defaults if possible