【问题标题】:How can I use dropzone without using the class in the form如何在不使用表单中的类的情况下使用 dropzone
【发布时间】:2014-03-28 21:07:46
【问题描述】:

我正在使用 dropzone.js 库使用 codeigniter 上传多个文件,我基本上希望在表单中有一个 div 并在该 div 中调用 class="dropzone"。但这似乎不起作用。

【问题讨论】:

  • 您只希望该 div 显示您放置的文件,然后在单击提交按钮时提交整个表单,包括输入和那些文件。我说的对吗?

标签: jquery dropzone.js


【解决方案1】:

在这种情况下,您必须添加以下方式。参见dropzone的文档http://www.dropzonejs.com/#create-dropzones-programmatically

<div class="dropzone" id="myId">
   <div class="fallback">
       <input id="files" multiple="true" name="files" type="file">
    </div>
</div>

在任何 js 文件的脚本中,您必须包含以下代码

<script>
$("div#myId").dropzone({ url: "/file/post" });
</script>

【讨论】:

    猜你喜欢
    • 2020-11-25
    • 2017-01-03
    • 2011-04-21
    • 2014-06-15
    • 2016-11-16
    • 1970-01-01
    • 1970-01-01
    • 2012-03-04
    • 1970-01-01
    相关资源
    最近更新 更多