PHP code example of kartik-v / yii2-widget-fileinput
1. Go to this page and download the library: Download kartik-v/yii2-widget-fileinput 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/ */
kartik-v / yii2-widget-fileinput example snippets
use kartik\file\FileInput;
// Usage with ActiveForm and model
echo $form->field($model, 'avatar')->widget(FileInput::classname(), [
'options' => ['accept' => 'image/*'],
]);
// With model & without ActiveForm
echo '<label class="control-label">Add Attachments</label>';
echo FileInput::widget([
'model' => $model,
'attribute' => 'attachment_1',
'options' => ['multiple' => true]
]);