介绍
可以拖拽上传的 js库
同类类库
1.jquery.fileupload http://blueimp.github.io/jQuery-File-Upload/
2. file-uploader https://github.com/Valums-File-Uploader/file-uploader
这2个类库分别用过..感觉,2轻巧方便些..
这个dropzonejs 其实也很轻巧
用法
1. add js and css style
<link href="~/Dropzone/css/basic.css" rel="stylesheet" /> <link href="~/Dropzone/css/dropzone.css" rel="stylesheet" /> <script src="~/Dropzone/dropzone.min.js"></script>
2. post data
<form action="~/Home/SaveUploadedFile" method="post" enctype="multipart/form-data" class="dropzone" id="dropzoneForm"> </form>
3.handling Server Response
<script type="text/javascript"> Dropzone.options.dropzoneForm = { init: function () { this.on("complete", function (data) { var res = eval('(' + data.xhr.responseText + ')'); alert(res.Message); }); } }; </script>
4.支持较旧的浏览器.same ie6
具体例子 参考 官 http://www.dropzonejs.com/
]]>