Show Thumbnail In Fileinput (Kartik-V)

Image saved: /uploads

My code:

echo $form->field($model, 'image')->widget(FileInput::classname(), [

    'options' => ['accept' => 'uploads/*'],

    'pluginOptions' => [

        'previewFileType' => 'image',

        'showPreview' => true,

        'showCaption' => FALSE,

        'showRemove' => FALSE,

        'showUpload' => FALSE,

        'browseClass' => 'btn btn-primary btn-block',

        'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ',

        'browseLabel' =>  'Select Photo'



I do not see the uploaded image to display! Any idea please?

You need to pass initialPreview (and optionally initialCaption) for displaying uploaded image from server. Check the first example in the File Input demo docs.

'pluginOptions' => [


        Html::img("/path/to/uploaded/image.jpg", ['class'=>'file-preview-image', 'alt'=>'The Moon', 'title'=>'The Moon']),


    'initialCaption'=>"The Uploaded Moon"


Thanks u very much! So cute !