Richfilemanager列出具有自定义扩展名的文件

时间:2017-08-22 13:48:29

标签: php nsfilemanager

RichFileManager-PHP 1库来浏览我的s3文件。我完成了配置document

文件列表仅包含标准指定文件,但我也希望列出 .tif 扩展文件。

如何允许在浏览器中列出自定义扩展文件。

1 个答案:

答案 0 :(得分:0)

我从以下document找到了答案。要允许其他扩展名在扩展名数组中添加扩展名(即我的情况下为tif),数组将如下所示,

$config = [

/**
 * Security section
 */
"security" => [
    /**
     * Default value "false". Allow write operations.
     * Set value to "true" to disable all modifications to the filesystem, including thumbnail generation.
     */
    "readOnly" => false,
    /**
     * Filename extensions are compared against this list, after the right-most dot '.'
     * Matched files will be filtered from listing results, and will be restricted from all file operations (both read and write).
     */
    "extensions" => [
        /**
         * Default value "ALLOW_LIST". Takes value "ALLOW_LIST" / "DISALLOW_LIST".
         * If is set to "ALLOW_LIST", only files with extensions that match `restrictions` list will be allowed, all other files are forbidden.
         * If is set to "DISALLOW_LIST", all files are allowed except of files with extensions that match `restrictions` list.
         */
        "policy" => "ALLOW_LIST",
        /**
         * Default value "true".
         * Whether extension comparison should be case sensitive.
         */
        "ignoreCase" => true,
        /**
         * List of allowed / disallowed extensions, depending on the `policy` value.
         * To allow / disallow files without extension, add / remove the empty string "" to / from this list.
         */
        "restrictions" => [
            "",
            "jpg",
            "jpe",
            "jpeg",
            "gif",
            "png",
            "svg",
            "txt",
            "pdf",
            "odp",
            "ods",
            "odt",
            "rtf",
            "doc",
            "docx",
            "xls",
            "xlsx",
            "ppt",
            "pptx",
            "csv",
            "ogv",
            "avi",
            "mkv",
            "mp4",
            "webm",
            "m4v",
            "ogg",
            "mp3",
            "wav",
            "zip",
            "md",
            "tif"
        ],
    ],
    /**
     * Files and folders paths relative to the user storage folder (see `fileRoot`) are compared against this list.
     * Matched items will be filtered from listing results, and will be restricted from all file operations (both read and write).
     */
    "patterns" => [
        /**
         * Default value "ALLOW_LIST". Takes value "ALLOW_LIST" / "DISALLOW_LIST".
         * If is set to "ALLOW_LIST", only files and folders that match `restrictions` list will be allowed, all other files are forbidden.
         * If is set to "DISALLOW_LIST", all files and folders are allowed except of ones that match `restrictions` list.
         */
        "policy" => "DISALLOW_LIST",
        /**
         * Default value "true".
         * Whether patterns comparison should be case sensitive.
         */
        "ignoreCase" => true,
        /**
         * List of allowed / disallowed patterns, depending on the `policy` value.
         */
        "restrictions" => [
            // files
            "*/.htaccess",
            "*/web.config",
            // folders
            "*/_thumbs/*",
            "*/.CDN_ACCESS_LOGS/*",
        ],
    ],
    /**
     * Default value "true".
     * Sanitize file/folder name, replaces gaps and some other special chars.
     */
    "normalizeFilename" => true,
],
];