elitedivision/amos-attachments
Extension for file uploading and attaching to the models
1.20.1
2024-09-05 10:03 UTC
Requires
- php:>=5.4.0
- ext-sockets:*
- bower-asset/jquery-cropper:^1.0
- elitedivision/amos-core:^1.32.0
- himiklab/yii2-colorbox-widget:*
- kartik-v/yii2-widget-fileinput:*
- rosell-dk/webp-convert:^2.9.2
- uitrick/yii2-widget-upload-crop:^1.0.0
- xantios/mimey:^2.2.0
- yiisoft/yii2-jui:^2.0
- yiisoft/yii2-imagine:^2.1.0
- yurkinx/yii2-image:*
Requires (Dev)
- phpunit/phpunit:~4.0
- phpunit/dbunit:~1.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-master
- 1.20.1
- 1.20.0
- 1.18.1
- 1.15.1
- 1.15.0
- 1.12.2
- 1.12.1
- 1.12.0
- 1.11.0
- 1.10.1
- 1.10.0
- 1.8.1
- 1.8.0
- 1.7.0
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.0
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.13
- 1.1.12
- 1.1.11
- 1.1.10
- 1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8.x-dev
- 1.0.8
- 1.0.7.x-dev
- 1.0.7
- 1.0.6.x-dev
- 1.0.5.x-dev
- 1.0.4.x-dev
- 1.0.4.2-dev
- 1.0.4.1-dev
- 1.0.3.x-dev
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0
- dev-test/1.21.0/3
- dev-dof/1.21.0/1
- dev-test/1.21.1/2
- dev-michelec/1.21.1/1
- dev-test/1.21.1/1
- dev-daniele/cruscotto-1.21.0/1
- dev-test/1.21.0/2
- dev-michelec/1.16.0/1
- dev-test/1.19.1/2
- dev-michelec/1.21.0/1
- dev-elena/1.21.0/1
- dev-test/1.14.2/1-webp
- dev-test/1.21.0/1
- dev-fabiano/1.20.1/1
- dev-stefanob/1.20.1/1
- dev-test/1.20.0/2
- dev-fabiano/1.17.0/2
- dev-test/1.17.0/3
- dev-test/1.7.1/1
- dev-test/1.20.1/1
- dev-daniele/cruscotto-1.20/1
- dev-test/1.20.0/1
- dev-deletemichelec
- dev-test/1.19.1/4
- dev-elena/1.19.1/3
- dev-ccia-accessibility-30102
- dev-test/1.19.1/3
- dev-michelec/1.19.1/2
- dev-test/1.19.1/1
- dev-michelec/1.19.1/1
- dev-fabiano/1.19.1/1
- dev-test/1.17.2/1
- dev-cesari/1.18.2/1
- dev-test/1.18.2/2
- dev-test/1.18.2/1
- dev-cesari/1.18.0/4
- dev-test/1.18.0/5
- dev-test/1.18.0/4
- dev-test/1.17.0/2
- dev-rc/1.18.1/1
- dev-test/1.17.1/1
- dev-test/1.18.0/3
- dev-test/1.18.0/2
- dev-stefanob/1.18.0/2
- dev-test/1.17.0/1
- dev-test/1.18.0/1
- dev-provamrg
- dev-test/1.3.4/1
- dev-dof/1.17.0/1
- dev-mirko/1.17.0/1
- dev-test/1.16.1/1
- dev-gianluca/1.16.1/1
- dev-stefanob/1.16.0/3
- dev-fabiano/1.16.0/3
- dev-test/1.16.0/3
- dev-cesari/1.16.0/3
- dev-cesari/1.16.0/2
- dev-test/1.16.0/2
- dev-stefanob/1.16.0/2
- dev-la_francesca/databank_imamgini_modificato
- dev-marco-boselli/1.16.0/2
- dev-michele-barillani/1.16.0/2
- dev-test/1.15.1/1
- dev-cesari/1.15.0/1
- dev-test/1.16.0/1
- dev-test/1.15.0/1
- dev-dof/1.15.1/1
- dev-test/1.15.2/1
- dev-gianluca/1.15.0/5
- dev-test/1.15.0/5
- dev-test/1.15.0/3
- dev-test/1.15.0/4
- dev-gianluca/databanck_immagini_modificato
- dev-scarface/mirko/1.12.2/3
- dev-test/1.15.0/2
- dev-test/1.14.2/1
- dev-dof/1.15.0/1
- dev-la_francesca/1.15.0
- dev-test/1.14.1/5
- dev-test/1.14.1/4
- dev-test/1.12.3/1
- dev-test/1.13.2/1
- dev-cesari/1.14.1/3
- dev-test/1.14.1/3
- dev-fabiano/1.14.1/2
- dev-dof/1.14.1/2
- dev-test/1.14.1/2
- dev-test/1.14.1/1
- dev-dof/1.14.1/1
- dev-test/1.14.0/2
- dev-test/1.14.0/3
- dev-test/1.14.0/1
- dev-mirko/1.12.2/3
- dev-test/1.13.1/1
- dev-test/1.12.2/2
- dev-mirko/1.12.2/1
- dev-test/1.12.1/1
- dev-gianluca/1.12.0/1
- dev-test/1.12.0/5
- dev-test/1.8.2/1
- dev-daniele/1.8.2/1
- dev-test/1.12.0/4
- dev-stefanob/1.12.0/4
- dev-test/1.12.0/3
- dev-test/1.8.1/1
- dev-michelezucchini/1.8.1/1
- dev-test/1.12.0/2
- dev-michelezucchini/1.12.0/2
- dev-daniele/1.12.0/2
- dev-test/1.12.0/1
- dev-marco/1.12.0/1
- dev-la_francesca/1.12.0
- dev-test/1.11.1/2
- dev-test/1.11.1/1
- dev-la_francesca/1.10.1
- dev-intranet-aria/1.9.0/1
- dev-test/1.10.0/3
- dev-la_francesca/1.10.0/2
- dev-test/1.11.0/2
- dev-test/1.10.1/1
- dev-test/1.11.0/1
- dev-michelezucchini/1.11.0/1
- dev-mattia/1.7.1
- dev-test/1.10.0/2
- dev-test/1.10.0/1
- dev-mattia/test_merge_1.10.0
- dev-test_merge_1.10.0
- dev-test/1.9.0/2
- dev-michelezucchini/1.7.0/4
- dev-test/1.7.0/4
- dev-riccardo/1.7.0/4
- dev-test/1.9.0/1
- dev-mattia/1.9.0/1
- dev-la_francesca/databank_v2
- dev-test/1.6.2/1
- dev-riccardo/1.7.0/3
- dev-prova_merge_databank
- dev-stefan/test/1.7.0/3
- dev-michelezucchini/1.8.0/2
- dev-test/1.8.0/2
- dev-test/1.3.3/1
- dev-scarface_rc_1.3.0
- dev-test_merge_1.8.0
- dev-test/1.8.0/1
- dev-dam_s3_notmerge
- dev-test/1.6.1/1
- dev-dof/1.7.0/3
- dev-test/1.7.0/3
- dev-la_francesca/databank
- dev-test/1.6.0/3
- dev-test/1.5.0
- dev-test/1.6.0/2
- dev-bug/1.0
- dev-test/1.7.0/1
- dev-dof/1.3.2/2
- dev-test/1.3.2/2
- dev-la_francesca/1.6.0
- dev-elena/1.6.0/1
- dev-lucal/1.1.11/1
- dev-gianluca/1.6.0/1
- dev-michelezucchini/1.6.0/1
- dev-test/1.6.0/1
- dev-daniele/feature/ajax_delete
- dev-elena/1.5.0
- dev-mattia/arter/1.5.0
- dev-mattia/befe
- dev-test/1.3.0
- dev-test/1.3.2/1
- dev-michele.zucchini/1.3.2
- dev-michele.zucchini/1.3.0
- dev-scarface/1.5.0
- dev-test/befe
- dev-test/s3
- dev-test/1.4.0
- dev-scarface_ebike_140
- dev-nicola/1.3.0
- dev-fabiot
- dev-la_francesca/event_wizard_v2
- dev-open20/1.2.1/1
- dev-la_francesca/event_wizard
- dev-melanie-test-1.2.0
- dev-mattia/testi
- dev-fabiot_fix_1.2.1
- dev-test/1.2.1
- dev-test/1.2.0
- dev-bootstrapitalia
- dev-dof/wizard_eventi
- dev-riccardo/1.2.0
- dev-la_francesca/googledrive
- dev-test/1.1.12/1
- dev-old_master
- dev-test/1.1.11/1
- dev-la_francesca/vapt
- dev-ASTER_PR-4
- dev-la_fancesca/1.1.11/1
- dev-POI
- dev-POI_TEST/1.1.11/1
- dev-arca/1.1.10
- dev-asp_energia
- dev-piattaforma_elite
- dev-umbria
- dev-la_francesca/1.1.10/2
- dev-test/1.1.10/1
- dev-la_francesca/1.1.10/1
- dev-POI_TEST/1.1.0/1
- dev-POI_TEST/1.1.10/1
- dev-test/1.1.9/2
- dev-simone/1.1.10/1
- dev-la_francesca/1.1.9/1
- dev-fabiot_test
- dev-test/1.1.9/1
- dev-riccardo/1.1.9/2
- dev-riccardo/1.1.9/1
- dev-riccardo/1.1.8/1
- dev-test/1.1.8/1
- dev-DEPLOY_POI_20180921
- dev-test/1.1.7/1
- dev-cinzia
- dev-riccardo/1.1.7/1
- dev-enrica/1.1.7/1
- dev-la_francesca/1.1.6/1
- dev-test/1.1.6/1
- dev-riccardo/1.1.6/1
- dev-milestone277
- dev-simone/1.1.6/1
- dev-simone/1.1.5/change-request-4
- dev-test/1.1.5/2
- dev-simone/1.0.11/changerequest-4
- dev-test/1.1.5/1
- dev-fabiot_1.1.3
- dev-fabiot_1.0.12
- dev-test/1.0.11/1
- dev-tosgat
- dev-test/1.0.9/12
- dev-test/1.0.9/9
- dev-test/1.0.9/11
- dev-test/1.0.9/10
- dev-security
- dev-test/1.0.9/8
- dev-test/1.0.9/7
- dev-test/1.0.9/6
- dev-enrico_1.0.9/6
- dev-test/1.0.9/5
- dev-test/1.0.9/4
- dev-test/1.0.9/3
- dev-test/1.0.9/2
- dev-pivanti_1.0.9
- dev-test/1.0.9/1
- dev-rudy_1.0.7
- dev-damian_1.0.6
- dev-fabiot_1.0.6
- dev-pivanti_1.0.4.3
- dev-fabiot_1.0.4.2
- dev-simone_1.0.4
README
Extension for file uploading and attaching to the models
Demo
You can see the demo on the krajee website
Installation
- The preferred way to install this extension is through composer.
Either run
composer require elitedivision/amos-attachments
or add
"elitedivision/amos-attachments": ">=1.0"
to the require section of your composer.json
file.
- Add module to your main config in common:
<?php
'aliases' => [
'@file' => dirname(__DIR__),
],
'modules' => [
'attachments' => [
'class' => 'elitedivision\amos\attachments\FileModule',
'webDir' => 'files',
'tempPath' => '@common/uploads/temp',
'storePath' => '@common/uploads/store',
// 'tableName' => '{{%attach_file}}' // Optional, default to 'attach_file'
],
],
Also, add these lines to your console config:
<?php
'controllerMap' => [
'attachments' => [
'class' => 'yii\console\controllers\MigrateController',
'migrationPath' => '@amos_attachments/migrations'
],
],
- Apply migrations
php yii migrate/up --migrationPath=@vendor/elitedivision/amos-attachments/src/migrations
- Attach behavior to your model (be sure that your model has "id" property)
<?php
use yii\helpers\ArrayHelper;
/**
* Adding the file behavior
*/
public function behaviors()
{
return ArrayHelper::merge(parent::behaviors(), [
'fileBehavior' => [
'class' => \file\behaviors\FileBehavior::className()
]
]);
}
/**
* Add the new fields to the file behavior
*/
public function rules()
{
return ArrayHelper::merge(parent::rules(), [
[['my_field_multiple_files', 'my_field_single_file'], 'file'],
]);
}
Make sure that you have added
'enctype' => 'multipart/form-data'
to the ActiveForm optionsMake sure that you specified
maxFiles
in module rules andmaxFileCount
onAttachmentsInput
to the number that you wantYoure ready to use, See How