【问题标题】:Bootstrap FileInput Fill Input Value in Initial PreviewBootstrap FileInput 在初始预览中填充输入值
【发布时间】:2020-07-05 12:09:07
【问题描述】:

我正在使用 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},
  ],
 });

提前致谢!!

【问题讨论】:

    标签: bootstrap-file-input


    【解决方案1】:

    查看refresh method 的文档。为此,您需要调用 destroy 方法,然后使用完整的新选项重新初始化插件。

    【讨论】:

      猜你喜欢
      • 2017-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多