PHP code example of zrk4939 / yii2-files-module

1. Go to this page and download the library: Download zrk4939/yii2-files-module library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zrk4939 / yii2-files-module example snippets


 'files' => [
    'class' => 'zrk4939\modules\files\FilesModule',
    'extensions' => ['png', 'jpg', 'jpeg', 'gif', 'pdf', 'txt', 'zip'],
    'uploadPath' => '@webroot/uploads',
    'rootPath' => '@webroot',
 ],

'files*' => [
    'class' => 'yii\i18n\PhpMessageSource',
    'sourceLanguage' => 'en-US',
    'basePath' => "@zrk4939/modules/files/messages",
    'fileMap' => [
        'files' => 'translation.php',
    ]
],


echo $form->field($model, 'images_arr')->widget(\zrk4939\modules\files\widget\FilesWidget::className(), [
    'multiple' => true,
    'files' => $model->images,
    'types' => [
        'image/*'
    ]
]);

$imageTypes = Json::encode([
    'image/*'
]);

'editorOptions' => [
    'filebrowserBrowseUrl' => Url::to(['/files/manage/index', 'frame' => 1]),
    'filebrowserImageBrowseUrl' => Url::to(['/files/manage/index', 'frame' => 1, 'types' => $imageTypes]),
],