dongshi9489 2017-02-24 15:06
浏览 33
已采纳

适用于Yii2的KCFinder

I installed KCFinder extension in my yii2 application via composer. In view I using next code:

        use iutbay\yii2kcfinder\KCFinderInputWidget;

        echo KCFinderInputWidget::widget([
            'name' => 'file',
        ]);

Widget works but I can't upload files because there is no 'Upload' button in widget.

  • 写回答

1条回答 默认 最新

  • doulangpeng3933 2017-02-24 15:28
    关注

    Check widget description, https://github.com/iutbay/yii2-kcfinder. You need set option 'access.files.upload' in 'true'.

       $kcfOptions = array_merge(KCFinder::$kcfDefaultOptions, [
            'uploadURL' => Yii::getAlias('@web').'/upload',
            'access' => [
                'files' => [
                    'upload' => true,
                    .......
            ],
        ]);
    
        // Set kcfinder session options
        Yii::$app->session->set('KCFINDER', $kcfOptions);
    

    You should rewrite options after you created widget

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?