PHP code example of templesuite / yii2-attachments
1. Go to this page and download the library: Download templesuite/yii2-attachments 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/ */
templesuite / yii2-attachments example snippets
'modules' => [
...
'attachments' => [
'class' => templesuite\attachments\Module::className(),
'tempPath' => '@app/uploads/temp',
'storePath' => '@app/uploads/store',
'rules' => [ // Rules according to the FileValidator
'maxFiles' => 10, // Allow to upload maximum 3 files, default to 3
'mimeTypes' => 'image/png', // Only png images
'maxSize' => 1024 * 1024 // 1 MB
],
'tableName' => '{{%attachments}}' // Optional, default to 'attach_file'
]
...
]