PHP code example of andreyv / yii2-aws-file-input-widget

1. Go to this page and download the library: Download andreyv/yii2-aws-file-input-widget 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/ */

    

andreyv / yii2-aws-file-input-widget example snippets


'components' => [
    ...
    'aws' => [
        'class' => andreyv\aws\fileinput\components\Aws::class,
        'credentials' => [
            'key' => 'aws-access-key',
            'secret' => 'aws-secret',
        ],
        'region' => 'aws-region',
        'bucket' => 'bucket-name',
    ],
    ...
],


echo $form->field($model, 'image')->widget(AwsFileInput::class, [
    'options' => ['accept' => 'image/*'], //acceptable files
]);

echo $form->field($model, 'image')->widget(AwsFileInput::class, [
    'awsComponent' => 'awsComponentName', //custom component name, `aws` by default
    'uniqueKey' => 'uniqueKey', //model unique attribute, `id` by default
    'options' => ['accept' => 'image/*'], //acceptable files
]);

echo $form->field($model, 'image')->widget(AwsFileInput::class, [
    'awsComponent' => 'awsComponentName', //custom component name, `aws` by default
    'fileNameParts' => [$model->someAttribute, 'some-key'], //custom file name parts, if not set `uniqueKey` will be used
    'options' => ['accept' => 'image/*'], //acceptable files
]);

php composer.phar