PDA

View Full Version : I just fixed a bug when editor upload a file with multibyte filename


leoyue
01-27-2008, 06:40 AM
/Class/File.class.php

Some editor complained that they lost attached file when they upload some files in editor interface.

I checked them with SSH, those file's name was changed due to encoder problem(gb2312 -> utf8, like 使用说明.txt -> 浣跨敤璇存槑.txt), so I just skip those convert issues, replace filename with numeric. It's should be no problem in pure english system, but will occur in Asian and other strange language system.

Line 52:
function radnom_file($file){
//$file_basename = $this->get_basename($file).'_'.rand(100000000,999999999);
$file_basename = date("Ymd") . rand(100,999).'_'.rand(100000000,999999999);
...


Also works for VIVVO 4.x