Код: Выделить всё
<?=
$form->field($model_registration, 'piece_recto_doc')->widget(FileInput::classname(), [
// 'name' => 'file',
// 'id' => 'fileUpload',
'attribute' => 'attachment_1[]',
'options'=>[
'multiple'=>false,
'options' => ['accept' => 'image/*'],
],
'pluginOptions' => [
'initialPreviewCount'=>1,
'initialPreviewShowDelete' => true,
'fileActionSettings'=> [
'showZoom'=> false,
'indicatorNew'=> ' '
],
'theme' => 'fa',
'initialPreviewAsData' => true, // identify if you are sending preview data only and not the raw markup
'allowedFileExtensions'=>['jpg','png'],
'uploadUrl' => Url::to(['/driver/identity-recto-doc']),
'uploadExtraData' => [
// 'album_id' => 20,
// 'cat_id' => 'Nature'
],
'overwriteInitial'=> false,
'initialPreviewFileType' => 'image', // image is the default and can be overridden in config below
'initialPreview' => ($model_registration->piece_recto_doc !==null) ? [
"/uploads_registration_driver/piece_recto/".$model_registration->piece_recto_doc] : [],
'initialPreviewConfig' => [
['url' => "/driver/delete-image", 'key' => 'piece_recto'],
],
'maxFileCount' => 1,
'minFileCount' => 1
]
])->label(false);
?>