替换代码

    wp-admin/includes/file.php,以3.0.3为例:

    1. function wp_handle_upload( &$file, $overrides = false, $time = null ) {
    2. //....
    3. // Move the file to the uploads dir
    4. //$new_file = $uploads['path'] . "/$filename";
    5. // 修正中文文件名编码问题
    6. $new_file = $uploads['path'] . "/" . iconv("UTF-8","GB2312",$filename);
    7. //...
    8. //return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'upload' );
    9. // 修正中文文件名编码问题
    10. return apply_filters( 'wp_handle_upload', array( 'file' => $uploads['path'] . "/$filename", 'url' => $url, 'type' => $type ) , 'upload');
    11. 其中的 iconv("UTF-8","GB2312",$filename); 也可以使用“GBK”编码。


    转载于:https://www.cnblogs.com/elfsundae/archive/2010/12/20/1911219.html