我正在使用kartik fileinput扩展,我想为每张图片添加一个单选按钮,以便用户可以选择所需的照片,我的代码在视图中是:
<?= $form->field($model, 'imageFiles[]')->widget(FileInput::classname(), [
'options' => ['multiple' => true, 'accept' => 'image/*', 'id'=>'inputFile'],
'pluginOptions' => [
'layoutTemplates' => ['preview'=>
" <div class='file-preview-thumbnails'>\n" .
" </div>\n" .
" <div class='clearfix'></div>" .
" <div class='file-preview-status text-center text-success'></div>\n".
" <div class='kv-fileinput-error'></div>\n",
'footer' => "<div class=\'file-thumbnail-footer\'>\n" .
" <div class='file-caption-name' style='width:{width}'>{caption}</div>\n" .
" {progress} {actions}" .
'<div><br>
<div class="radio-btn">
<input type="radio" value={caption} id="rc1" name="rc1" checked="checked">
<label for="rc1" onclick><span class="label label-default" style="font-size: 1em;">Main image</span></label>
</div></div>'.
"</div>"
],
'uploadUrl' => '/ads/create',
'maxFileCount' => 4,
'showUpload' => false,
'showCaption' => false,
'showClose' => false,
]
]);
?>
我希望<input type="radio" value={caption} id="rc1">
更改为<input type="radio" value=FILENAME id="rc1">
,具体取决于所选的任何文件,
请指导我,谢谢。