【问题标题】:Richfilemanager list files with custom extensionRichfilemanager 列出具有自定义扩展名的文件
【发布时间】:2017-08-22 13:48:28
【问题描述】:

RichFileManager-PHP 1 库来浏览我的 s3 文件。我通过配置document

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

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

【问题讨论】:

    标签: php nsfilemanager


    【解决方案1】:

    我从关注document 中找到了答案。要允许其他扩展在 extension 数组中添加扩展名(即我的例子中的 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,
    ],
    ];
    

    【讨论】:

      猜你喜欢
      • 2013-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-17
      • 1970-01-01
      • 2015-10-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多