在Bootstrap模式中使用Dropzone.js [英] Using Dropzone.js inside Bootstrap modal

查看:243
本文介绍了在Bootstrap模式中使用Dropzone.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 dropzone.js 将文件上传到服务器.我包含了所有必要的js和css文件,并将文件上传表单放入了引导程序模版中.

I'm using dropzone.js to upload files to the server. I included all the necessary js and css files and have put the file upload form inside a bootstrap modal.

我面临的问题是,在模式内,单击拖放区后不会触发文件选择窗口.我也无法拖放所需的文件.

The problem I'm facing is that, inside the modal the file select window does not get triggered once I click on the dropzone. Nor am I able to drag and drop the required files.

我正在使用 Laravel 4 .在这个问题上的任何方向都很好!提前致谢.

I'm using Laravel 4. Any direction on this issue would be great! Thanks in advance.

这是我的代码:

<script type="text/javascript" src="{{ URL::asset('js/dropzone/dropzone-      3.8.4/downloads/dropzone.js') }}"></script>
<link rel="stylesheet" type="text/css" href="{{ URL::asset('js/dropzone/dropzone-3.8.4/downloads/css/dropzone.css') }}">
<div id="fileToBeAdded">
    <div class="toBeAdded" data-type="file" style="">
        <button id="submit-all">Submit all files</button>
        <form action="{{ url('files/upload') }}" id="myDropzone" class="dropzone">
             <div class="fallback">
                 <input name="files[]" type="file" multiple />
             </div>
        </form>
    </div>
</div>

推荐答案

我希望Dropzone的初始化可能存在一些问题

I hope the there might be some problem with initialization of Dropzone

尝试在其他元素的点击事件上触发Dropzone.

try to trigger Dropzone on click event of some other element.

喜欢-

$(document).on('click','#someelement',function(){
 var myDropzone = new Dropzone("form#formIdWhichULikeToTriggerWithDropzone", { url: 'file_upload_route'});
});

这篇关于在Bootstrap模式中使用Dropzone.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆