WordPress.org

Make WordPress Core

Ticket #9393: 9393-wp_handle_upload.diff

File 9393-wp_handle_upload.diff, 721 bytes (added by sivel, 6 years ago)

Set empty file type if skipping file type check. Fixes notices when importing.

  • wp-admin/includes/file.php

     
    282282 
    283283                if ( !$type ) 
    284284                        $type = $file['type']; 
     285        } else { 
     286                $type = ''; 
    285287        } 
    286288 
    287289        // A writable uploads dir will pass this test. Again, there's no point overriding this one. 
     
    304306        // Compute the URL 
    305307        $url = $uploads['url'] . "/$filename"; 
    306308 
    307         $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) ); 
    308  
    309         return $return; 
     309        return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) ); 
    310310} 
    311311 
    312312/**