pathinfo(), basename()解析中文問題(responsivefilemanager upload)

pathinfo($file) 在解析中文檔名時會產生錯誤,一定要搭配以下設定:

//這個設定可能跟Server有關,zh_TW有可能不會生效
setlocale(LC_ALL, "zh_TW.UTF-8");

//經過測試 en_US 也可以正常顯示中文
setlocale(LC_ALL, "en_US.UTF-8");

或是採用客製的function (經過測試有問題)

function path_info($filepath)  
{  
    $path_parts = array();  
    $path_parts ['dirname'] = rtrim(substr($filepath, 0, strrpos($filepath, '/')),"/")."/";  
    $path_parts ['basename'] = ltrim(substr($filepath, strrpos($filepath, '/')),"/");  
    $path_parts ['extension'] = substr(strrchr($filepath, '.'), 1);  
    $path_parts ['filename'] = ltrim(substr($path_parts ['basename'], 0, strrpos($path_parts ['basename'], '.')),"/");  
    return $path_parts;  
}