Dropzone.js is a light weight JavaScript library that turns an HTML element into a dropzone. This means that a user can drag and drop a file onto it, and the file gets uploaded to the server via AJAX.
If you want support, please use stackoverflow with the dropzone.js
tag and not the
GitHub issues tracker. Only post an issue here if you think you discovered a bug or have a feature request.
Please read the contributing guidelines before you start working on Dropzone!
Starting with version 2.0.0 this library does no longer depend on jQuery (but it still works as a jQuery module).
Dropzone is compatible with component, there's a standalone version and an AMD module that's compatible with RequireJS in the downloads folder.
thumbnail(file, data)
and display the image wherever you likeFor the full documentation and installation please visit www.dropzonejs.com
Please also refer to the FAQ.
For examples, please see the GitHub wiki.
Implicit creation:
<form id="my-awesome-dropzone" action="/target" class="dropzone"></form>
That's it. Really!
Dropzone will automatically attach to it, and handle file drops.
Want more control? You can configure dropzones like this:
// "myAwesomeDropzone" is the camelized version of the ID of your HTML element
Dropzone.options.myAwesomeDropzone = { maxFilesize: 1 };
...or instantiate dropzone manually like this:
new Dropzone("div#my-dropzone", { /* options */ });
Note that dropzones don't have to be forms. But if you choose another element you have to pass the
url
parameter in the options.
For configuration options please look at the documentation on the website or at the source.
If you want to register to some event you can do so on the dropzone
object itself:
Dropzone.options.myDropzone({
init: function() {
this.on("error", function(file, message) { alert(message); });
}
});
// or if you need to access a Dropzone somewhere else:
var myDropzone = Dropzone.forElement("div#my-dropzone");
myDropzone.on("error", function(file, message) { alert(message); });
For a list of all events, please look at the chapter »listen to events« in the documentation or at the source.
For all the other browsers, dropzone provides an oldschool file input fallback.
I realize that there are already other libraries out there but the reason I decided to write my own are the following:
See LICENSE file
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。