Make WordPress Core

Ticket #8205: 8205.diff

File 8205.diff, 699 bytes (added by DD32, 16 years ago)
  • wp-admin/includes/media.php

     
    173173 */
    174174function media_handle_upload($file_id, $post_id, $post_data = array()) {
    175175        $overrides = array('test_form'=>false);
    176        
    177         $post = get_post($post_id);
    178         $time = $post->post_date_gmt;
    179176
     177        $time = current_time('mysql', true);
     178        if ( $post = get_post($post_id) ) {
     179                if ( '0000-00-00 00:00:00' != $post->post_date_gmt )
     180                        $time = $post->post_date_gmt;
     181        }
     182
    180183        $file = wp_handle_upload($_FILES[$file_id], $overrides, $time);
    181184
    182185        if ( isset($file['error']) )