I use YII2 + /kartik-v/bootstrap-fileinput
plugin. I need to upload file when user just drop it into upload input. Make it by ajax request. When I set "showUpload
" option to false
, and set "uploadUrl
" with ajax action, no request to server happens on change file event.
<?= $form->field($model, 'logotype')->widget(FileInput::class, [
'options' => [ 'accept' => 'image/*' ],
'pluginOptions' => [
'showCaption' => false,
'showRemove' => false,
'showUpload' => false,
'browseClass' => 'btn btn-primary btn-block',
'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ',
'uploadUrl'=> '/module/controller/action'
],
]); ?>
I expect the form to create ajax POST
on the server with my file in data when user select image and without press "upload" button additionally. Is it possible to make it using this plugin? Or I should write a custom handler onchange
event? Maybe there is some kind of callback in plugin options.