serhatozles / yii2-elfinder
Yii2 Elfinder
Installs: 76
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Language:JavaScript
Type:yii2-extension
Requires
This package is not auto-updated.
Last update: 2024-12-17 04:52:09 UTC
README
Yii2 Elfinder
See: http://elfinder.org/
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist serhatozles/yii2-elfinder "dev-master"
or add
"serhatozles/yii2-elfinder": "dev-master"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
Add Main.php
'controllerMap' => [ 'elfinder' => [ 'class' => 'serhatozles\elfinder\Controller', // 'options' => [ //// 'height' => 250, //// 'getFileCallback' => 'function(url) { alert(url); }', // 'uiOptions' => [ // 'toolbar' => [ // ['back', 'forward'], // ['netmount'], // ['upload'], // ['open', 'download', 'getfile'], // ['info'], // ['quicklook'], // ['rm'], // ['edit', 'resize'], // ['search'], // ['view', 'sort'], // ['help'] // ] // ], // 'contextmenu' => [ // 'navbar' => ['open', '|', 'info'], // 'cwd' => ['reload', 'back', '|', 'upload', '|', 'sort', '|', 'info'], // 'files' => ['getfile', '|', 'open', 'quicklook', '|', 'download', '|', 'rm', '|', 'edit', 'resize', '|', 'info'] // ], // 'onlyMimes' => ["image"], // ] ] // 'elfinder2' => [ // 'class' => 'serhatozles\elfinder\Controller', // ... // ] // ... ],
View:
echo \serhatozles\elfinder\elFinder::widget([ 'ajax' => Url::to(['site/elfinder']), // 'controller' => 'elfinder2', // 'height' => 270, ]);
Controller Action:
public $enableCsrfValidation = false; public function actionElfinder() { $elFinder = new \serhatozles\elfinder\elFinder; echo $elFinder->connector([ // 'debug' => true, 'roots' => [ [ 'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED) 'path' => Yii::getAlias('@webroot/files/'), // path to files (REQUIRED) 'URL' => Yii::getAlias('@web/files/'), // URL to files (REQUIRED) 'mimeDetect' => 'internal', 'onlyMimes' => ['image'], ], ] ]); }