Answer the question
In order to leave comments, you need to log in
How to display file size and extra buttons in Kartik-v FileInput YII2 widget?
I can't achieve this result in any way:
I.e. need to display a drag and drop button, a button to open a preview and a file size.
In the first demo , everything works "out of the box", the author does not make any extra settings - and everything works "as it should".
In fact, it turns out like this:
I think it's all about templates . I'm trying to change the template to:
'layoutTemplates' => [
'size' => '<span>{sizeText}</span>',
'footer' => '<div class="file-thumbnail-footer">
<div class="file-caption-name" style="width:{width}">{caption}{size}</div>
{progress} {actions}
</div>',
],
Answer the question
In order to leave comments, you need to log in
Everything is there and detailed: demos.krajee.com/widget-details/fileinput
Specifically size:
echo FileInput::widget([
'name' => 'attachment_49[]',
'options'=>[
'multiple'=>true
],
'pluginOptions' => [
'initialPreview'=>[
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/e1/FullMoon2010.jpg/631px-FullMoon2010.jpg",
"http://upload.wikimedia.org/wikipedia/commons/thumb/6/6f/Earth_Eastern_Hemisphere.jpg/600px-Earth_Eastern_Hemisphere.jpg"
],
'initialPreviewAsData'=>true,
'initialCaption'=>"The Moon and the Earth",
'initialPreviewConfig' => [
['caption' => 'Moon.jpg', 'size' => '873727'],
['caption' => 'Earth.jpg', 'size' => '1287883'],
],
'overwriteInitial'=>false,
'maxFileSize'=>2800
]
]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question