dev-master
9999999-dev https://github.com/serhatozles/yii2-elfinderYii2 Elfinder
GPL-2.0+
The Requires
by serhatozles
extension yii2
Yii2 Elfinder
Yii2 Elfinder, (*1)
See: http://elfinder.org/, (*2)
The preferred way to install this extension is through composer., (*3)
Either run, (*4)
php composer.phar require --prefer-dist serhatozles/yii2-elfinder "dev-master"
or add, (*5)
"serhatozles/yii2-elfinder": "dev-master"
to the require section of your composer.json
file., (*6)
Once the extension is installed, simply use it in your code by :, (*7)
Add Main.php, (*8)
'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:, (*9)
echo \serhatozles\elfinder\elFinder::widget([ 'ajax' => Url::to(['site/elfinder']), // 'controller' => 'elfinder2', // 'height' => 270, ]);
Controller Action:, (*10)
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'], ], ] ]); }
Yii2 Elfinder
GPL-2.0+
extension yii2