打開wp-admin/includes/file.php文件
找到wp_handle_upload這個函數,按照下面的代碼進行修改.主要修改兩行
function wp_handle_upload( &$file, $overrides = false, $time = null ) {
//部分代碼略去
// Move the file to the uploads dir
//$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');
}
1F
已經變成亂碼的怎么辦……
求解答!
B1
@ 米木文藝 @米木文藝 : 刪除掉啊,改名再重新上傳。