备注:我厌倦了所有问题&回答相关这个话题.
我想在我的Div标签中使用Dropzone.但是有些怎么不行.见代码Here
下面的代码段示例.
Dropzone.autodiscover = false; $("#mydropzone").dropzone({ //url: "/file/post",addRemoveLinks: true,maxFilesize: 0.5,dictDefaultMessage: '<span class="text-center"><span class="font-lg visible-xs-block visible-sm-block visible-lg-block"><span class="font-lg"><i class="fa fa-caret-right text-danger"></i> Drop files <span class="font-xs">to upload</span></span><span>  <h4 class="display-inline"> (Or Click)</h4></span>',dictResponseError: 'Error uploading file!' });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/dropzone.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/dropzone.css" rel="stylesheet"/> <link href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/basic.css" rel="stylesheet"/> <div class="clsBox-1" runat="server" > <div class="dropzone clsBox" id="mydropzone"> </div> </div>
解决方法
经过长时间的Dropzone研究后,我获得了最佳解决方案
HTML
<div class="clsBox-1" runat="server" > <div class="dropzone clsBox" id="mydropzone"> </div> </div>
脚本
Dropzone.autodiscover = false; // Dropzone class: var myDropzone = new Dropzone("div#mydropzone",{ url: "/file/post"}); // If you use jQuery,you can use the jQuery plugin Dropzone ships with: $("div#myDrop").dropzone({ url: "/file/post" });