【发布时间】:2020-01-23 13:48:29
【问题描述】:
我创建了一个 由两列组成的 Bootstrap 表单(使用 Bootstrap 4.3)。在这个表单中,我使用了一个自定义文件上传按钮。
该按钮允许我选择文件并按预期上传它们。
我唯一的问题是它在上传后不显示上传文件的名称(它应该替换“未选择文件”,例如显示“test.xlsx”)。
有人能告诉我如何让它工作吗?我需要为此添加任何 jQuery 等吗?
我的 HTML:
<div class="form-group row">
<label for="attachment" class="col-md-3 col-lg-2 col-form-label">
<span id="lblAttachment">Attachment</span>:
</label>
<div class="col-md-9 col-lg-10 input-group">
<div class="input-group-prepend">
<span class="input-group-text" id="lblFile">File</span>
</div>
<div class="custom-file">
<input type="file" class="custom-file-input" id="attachment" name="attachment" aria-describedby="lblFile"/>
<label for="attachment" class="custom-file-label">No file chosen</label>
</div>
</div>
</div>
非常感谢。
【问题讨论】:
标签: html forms twitter-bootstrap file-upload bootstrap-4