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

Posted

技术标签:

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

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

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

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

【问题讨论】:

【参考方案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,
],
];

【讨论】:

以上是关于Richfilemanager 列出具有自定义扩展名的文件的主要内容,如果未能解决你的问题,请参考以下文章

保存具有自定义扩展名的文件

如何在文档目录中创建具有自定义扩展名的文件?

如何检查我的 ios8 自定义键盘扩展是不是具有开放访问权限?

如何使用具有自定义文件扩展名的 H2 数据库?

无法在 IOS 13 上导入具有自定义 UTI 扩展名的文件

如何检查我的ios8自定义键盘扩展是否具有开放访问权限?