gevman/yii2-file-manager

为 Yii2 的文件管理模块

安装: 86

依赖项: 0

建议者: 0

安全: 0

星星: 8

关注者: 1

分支: 0

开放问题: 0

语言:CSS

类型:项目

2.3.2 2018-07-20 19:58 UTC

This package is auto-updated.

Last update: 2024-09-21 03:17:17 UTC


README

将此添加到 web.php

'bootstrap' => [/* other, */'file-manager'/*, other*/],
// and
'modules' => [
    /* other, */
    'file-manager' => [
        'class' => Gevman\FileManager\Module::class,
        'returnFullPath' => false,
        'uploadFolder' => '/uploads',
        'allowedExtensions' => [
            'images' => ['jpg', 'png', 'gif'],
        ],
        'cacheComponent' => 'cache',
        'beforeAction' => function() {
            if (Yii::$app->user->isGuest) {
                throw new \yii\web\ForbiddenHttpException(Yii::t('yii', 'You are not allowed to perform this action.'));
            }
        }
    ],
    /*, other*
],

还有一个用于自动化文件缩略图索引的命令行命令

在控制台配置中设置 @webroot 别名,首先添加此到配置文件后

'bootstrap' => [/* other, */'file-manager'/*, other*/],
// and
'modules' => [
    /* other, */
    'file-manager' => [
        'class' => Gevman\FileManager\Module::class,
        'returnFullPath' => true,
        'uploadFolder' => '/uploads',
        'cacheComponent' => 'cache',
    ],
    /*, other*
],

after run `php yii file-manager/index-files`