Answer the question
In order to leave comments, you need to log in
Why is deleting one file in kartik-v-fileinput deleting all other files?
I am using yii2 kartik-v-fileinput to upload images. Everything works, however, when one file is deleted in the preview, all the others are deleted too (they remain in the preview, but an empty array reaches the server, and there are no files there)
Preview type:
Field:
<?= $form->field($model, 'imgFiles[]')->widget(FileInput::class, [
'options' => ['accept' => 'image/*', 'multiple' => true, 'id' => 'img-456'],
'pluginOptions' => [
//'browseLabel' => '',
'showPreview' => true,
//'showCaption' => true,
//'dropZoneTitle' => '',
'showRemove' => true,
'showUpload' => false,
'showDelete' => true,
//'showUpload' => false,
//'showClose' => false,
//'previewFileType' => 'image',
'allowedFileExtensions' => ['jpg', 'png', 'jpeg'],
'maxFileCount' => 20,
'removeClass' => 'btn btn-danger img-btn',
'uploadUrl' => Url::to('some'),
'deleteUrl' => Url::to('site/delete-img'),
]
])->label(false) ?>
var_dump(UploadedFile::getInstances($form, 'imgFiles'));
exit();
Answer the question
In order to leave comments, you need to log in
Try to use the default configuration from the plugin examples.
Then turn on the properties one by one.
And it's not clear yet whether you send the drawings with the main form or separately. If separately, it needs to be handled a little differently.
If together uploadUrl seemed to be redundant.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question