wordpress上传含中文文件名出现乱码

一、首先到FTP里面找到wp-admin/includes/file.php这个文件。

二、查找wp_handle_upload在文件里面找到以下代码。

function wp_handle_upload( &$file, $overrides = false, $time = null ) {
 //$new_file = $uploads['path'] . "/$filename"; 
// 找到上面的代码,替换成下面的。 
$new_file = $uploads['path'] . "/" . iconv("UTF-8","GB2312",$filename);
//return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'upload' ); 
// 找到上面的代码,替换成下面的。  
return apply_filters( 'wp_handle_upload', array( 'file' => $uploads['path'] . "/$filename", 'url' => $url, 'type' => $type ) , 'upload');
posted @ 2018-01-09 14:34  小崔开发  阅读(237)  评论(0编辑  收藏  举报