Xibo 修正上傳中文檔名會空白

修改 {xibo}/3rdparty/jquery-file-upload/UploadHandler.php

主要是因為basename這個function對解析中文會有問題~

 protected function trim_file_name($name, $type, $index, $content_range) {
        // Remove path information and dots around the filename, to prevent uploading
        // into different directories or replacing hidden system files.
        // Also remove control characters and spaces (x00..x20) around the filename:

        //原本是
        //$name = trim(basename(stripslashes($name)), ".x00..x20");
        //修改為
        $name = preg_replace('/^.+[\\\/]/', '', $name);

        // Use a timestamp for empty filenames:
        if (!$name) {
            $name = str_replace('.', '-', microtime(true));
        }
        // Add missing file extension for known image types:
        if (strpos($name, '.') === false &&
            preg_match('/^image/(gif|jpe?g|png)/', $type, $matches)) {
            $name .= '.'.$matches[1];
        }
        return $name;
    }
This entry was posted in Xibo. Bookmark the permalink.