0

I've an application that was developed using Yii2, and this application I've use Kartik Input File for upload file.

Case

enter image description here From the example above, I want to remove / hide the "File" label.

And I think, that label based on model name.

This is the code I use:

<?=
$form->field($model, 'file')->widget(FileInput::classname(), [
    'options' => [
        'accept' => 'doc/*', 'file/*',
        'enableLabel' => false,
    ],
    'pluginOptions' => [
        'allowedFileExtensions' => ['csv', 'xls', 'xlsx'],
        'showUpload' => FALSE,
        'showPreview' => FALSE,
    ]
]);
?>

How do I can remove the label above?

Thanks

Community
  • 1
  • 1
Blackjack
  • 1,016
  • 1
  • 20
  • 51

1 Answers1

3

For removing the label you can simply use the following:

<?=
$form->field($model, 'file')->widget(FileInput::classname(), [
    'options' => [
        'accept' => 'doc/*', 'file/*',
        'enableLabel' => false,
    ],
    'pluginOptions' => [
        'allowedFileExtensions' => ['csv', 'xls', 'xlsx'],
        'showUpload' => FALSE,
        'showPreview' => FALSE,
    ]
])->label(false);
?>
Chinmay Waghmare
  • 5,368
  • 2
  • 43
  • 68