Skip to content

Instantly share code, notes, and snippets.

@imjjss
Created October 2, 2012 23:21
Show Gist options
  • Save imjjss/3823932 to your computer and use it in GitHub Desktop.
Save imjjss/3823932 to your computer and use it in GitHub Desktop.
upload file with chinese name
要修改的是wordpress\wp-admin\includes\file.php
查找:
$filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
在其后加上:
$fileTypeNameArr =explode("." , $filename);
$countNum=count($fileTypeNameArr)-1;
$fileExt = $fileTypeNameArr[$countNum]; //取得所上传文件后缀名
$filename = time().'-'.rand(0,999999999).'.'.$fileExt;//将文件由原名改为时间戳
@imjjss
Copy link
Author

imjjss commented Oct 2, 2012

this one doesn't work anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment