bootstrap-file-input - Bootstrap FileInput 在初始预览中填充输入值
问题描述
我正在使用 Krajee Bootstrap 文件输入。问题是,在我的编辑页面中,我想从记录中显示 PDF 文件的 initialPreview,但是当我提交表单进行更新时,文件输入发送空值。
这是我的代码:
形式 -
<div class="form-group col-md-4">
<label for="pdf_file">Document</label>
<div class="file-loading">
<input class="file" name="pdf_file" id="pdf_file" value="" type="file">
</div>
</div>
JS——
$("#pdf_file").fileinput({
theme: "fa",
allowedFileExtensions: ["pdf"],
maxFileCount: 1,
showUpload: false,
showCaption: false,
overwriteInitial: true,
fileType: "pdf",
browseClass: "btn btn-primary btn-md",
initialPreview: [
"http://localhost/local_storage/aPxU3p71hpLjaI3lbTXrjRuigUxU94pq.pdf",
],
initialPreviewAsData: true,
initialPreviewConfig: [
{type: "pdf", size: "100%", width: "100%", key: 1},
],
});
提前致谢!!
解决方案
检查文档以了解刷新方法。为此,您需要调用 destroy 方法,然后使用完整的新选项重新初始化插件。
推荐阅读
- django - Google 日历 OAuth 2.0 错误 403:access_denied
- powerbi - 筛选 Power Query 中的列,使其仅包含每年的最后一个日期
- laravel - Laravel 中的 Sanctum 身份验证超时
- flutter - CustomPainter 工具提示
- python - 如何通过命令关闭事件?不和谐.py
- typescript - React Native SegmentedControl:我如何使用 Typescript 输入大小写 onChange “事件”?
- plotly - 如何创建网格搜索的 3d 图
- assembly - 在汇编代码中使用 C 函数 (nasm)
- angularjs - Ionic/Angular 无法在真实手机中看到图像
- python - 使用 spaCy 3.0 将数据从旧的 Spacy v2 格式转换为全新的 Spacy v3 格式