I'm using lib Kartik in my project with the Yii 2 Framework . I have a form where I can add one or more files. As I show in the image below:
However,whenusingkartiktomultiplyupload,itonlysends1file.
Form:
<divclass="row">
<a class="btn btn-info btn-rounded pull-right" id="add-more-btn" title="Adicionar mais arquivos">Adicionar</a>
</div>
<div class="row arquivo_upload">
<div class="col-md-6" >
<?= $form->field($model, '[0]descricao')->textInput(['maxlength' => true]) ?>
</div>
<div class="col-md-5">
<?= $form->field($model, '[0]arquivo_url')->widget(\kartik\file\FileInput::classname(), [
'options' => ['multiple' => true],
'language' => 'pt',
'pluginOptions' => [
'showUpload' => false,
'showPreview' => false,
'browseLabel' => '',
'removeLabel' => '',
],
])->label('Arquivo') ?>
</div>
Using the standard fileInput of Yii, I can perform multiplu upload:
<div class="row">
<a class="btn btn-info btn-rounded pull-right" id="add-more-btn" title="Adicionar mais arquivos">Adicionar</a>
</div>
<div class="row arquivo_upload">
<div class="col-md-6" >
<?= $form->field($model, '[0]descricao')->textInput(['maxlength' => true]) ?>
</div>
<!-- FileInput Yii2 -->
<div class="col-md-5">
<?= $form->field($model, '[0]arquivo_url')->fileInput()->label('Arquivo') ?>
</div>