yii2-widget-fileinput

<?php
echo '<label class="control-label">任务图片</label>';
echo FileInput::widget([
    'name' => 'task_image_property[]',
    'options' => [
        'accept' => 'image/*',
        'multiple' => true
    ],
    'pluginOptions' => [
        'showUpload' => false,'initialPreview' => '',
        'initialPreviewAsData' => true,
        'initialPreviewShowDelete' => true,
        'fileActionSettings' => [
            'showRemove' => false,
        ],
        'overwriteInitial' => true,
        'previewFileType' => 'any',
        'uploadAsync'=> true,
        'uploadUrl' => Url::to(['image/img-upload'])
    ],
    'pluginEvents' => [
        'filebatchselected' => "function (event, files){ 
                $(this).fileinput('upload');//选择文件后自动上传
            }",
    ]
]);
?>

 

posted on 2018-09-09 16:07  Mr-Hawaii-Felix  阅读(176)  评论(0编辑  收藏  举报

导航