Giter Club home page Giter Club logo

dropzone's Introduction

Dropzone.js

Test and Release

Dropzone is a JavaScript library that turns any HTML element into a dropzone. This means that a user can drag and drop a file onto it, and Dropzone will display file previews and upload progress, and handle the upload for you via XHR.

It's fully configurable, can be styled according to your needs and is trusted by thousands.

Dropzone Screenshot

Quickstart

Install:

$ npm install --save dropzone
# or with yarn:
$ yarn add dropzone

Use as ES6 module (recommended):

import { Dropzone } from "dropzone";
const dropzone = new Dropzone("div#myId", { url: "/file/post" });

or use as CommonJS module:

const { Dropzone } = require("dropzone");
const dropzone = new Dropzone("div#myId", { url: "/file/post" });

๐Ÿ‘‰ Checkout our example implementations for different bundlers

Not using a package manager or bundler?

Use the standalone files like this:

<script src="https://unpkg.com/dropzone@5/dist/min/dropzone.min.js"></script>
<link
  rel="stylesheet"
  href="https://unpkg.com/dropzone@5/dist/min/dropzone.min.css"
  type="text/css"
/>

<div class="my-dropzone"></div>

<script>
  // Dropzone has been added as a global variable.
  const dropzone = new Dropzone("div.my-dropzone", { url: "/file/post" });
</script>


โš ๏ธ NOTE: We are currently moving away from IE support to make the library more lightweight. If you don't care about IE but about size, you can already opt into 6.0.0-beta.1. Please make sure to pin the specific version since parts of the API might change slightly. You can always read about the changes in the CHANGELOG file.

Community

If you need support please use the discussions section or stackoverflow with the dropzone.js tag and not the GitHub issues tracker. Only post an issue here if you think you discovered a bug.

If you have a feature request or want to discuss something, please use the discussions as well.

โš ๏ธ Please read the contributing guidelines before you start working on Dropzone!

Main features โœ…

  • Beautiful by default
  • Image thumbnail previews. Simply register the callback thumbnail(file, data) and display the image wherever you like
  • High-DPI screen support
  • Multiple files and synchronous uploads
  • Progress updates
  • Support for large files
    • Chunked uploads (upload large files in smaller chunks)
  • Support for Amazon S3 Multipart upload
  • Complete theming. The look and feel of Dropzone is just the default theme. You can define everything yourself by overwriting the default event listeners.
  • Browser image resizing (resize the images before you upload them to your server)
  • Well tested

MIT License

See the LICENSE file

dropzone's People

Contributors

2vcreation avatar adambom avatar andrew-nguyen avatar berdir avatar christianklemp-imt avatar ckovey avatar engineercoding avatar enyo avatar gaethofs avatar gyuchang avatar himazu avatar jacwright avatar jakesylvestre avatar jurreantonisse avatar kim3er avatar manu7691 avatar patrickbussmann avatar pborreli avatar phoet avatar rqman avatar sankargorthi avatar sjstulga avatar threepointone avatar tmaier avatar tvalletta avatar tylervigario avatar valiodotch avatar vigrond avatar vyorkin avatar xcambar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dropzone's Issues

Destroy dropzone object

I'm programmaticaly create multiple dropzone and store it in an array.
How can we destroy an object to free up memory?

love the simplicity of the script!

Dropzone Uploading process

I would like to ask if there is anyway to make a function creates "Done" button based on dropzone uploading. So if there is an uploading process going on the "Done" button will disappear otherwise it will be shown.

Event: all files uploaded

Is there any way to create event when e.g. 3 files (selected, dropped) has been uploaded successfully. I'd like to close popup and refresh opener after this.

Thanks a lot for this great tool.

Additional data

Which event and how I should use to submit additional data on every singe file upload?

Permissions

Hello!
I have a problem with dropzone.js, I always get the error "You do not have permission to access / dropzone / file-upload / on this server."
the fact is that I have the permissions of the file-upload folder to 777, anyone know how to fix it.
thank you very much

params are attached wrong

I don't understand coffeescript, thats why I didn't make a pullrequest.
For some reason the key and value of params are mixed up.

but on line 857 of the JS this
formData.append(name, key);
should be replaced with
formData.append(key, name);

After an onchange event of form fields outside of the dropzone, I execute

        Dropzone.options.mediaDropzone.params.type = parentTypeInput.val();
        Dropzone.options.mediaDropzone.params.parentId = parentIdInput.val();

Which results in the server receiving the key and value mixed up.

Re-designing the error message

The title may be confusing somehow, but what I've meant is what you can see in the picture below
Untitled-2

The error message went out of the edge. It's just "Width" matter I think !

horizontally images

when I upload a vertical image taken from my ipod this is shown horizontally, only about such images, nose happens if taken with an iphone or an ipad

Remove the "Browser not supported" info

Showing this message is rather confusing for users that don't know that it should be a drag'n'drop area. It will result in a lot better user experience for users with unsupported browsers if it would just show the upload form.

Reset dropzone to Pristine state

A way to recreate a dropzone on an element. This can be done having a method to unload dropzone from the element and then recreate it again. Or a new method to reset the state of the dropzone including removing all image previews and removing 'started' class from the dropzone container.

Currently the above functionality can be accomplished with something like:

// remove old dropzone
$dropzoneContainer.empty();

// re-create dropzone div
$dropzoneContainer.append($('<div id="dropzone" class="dropzone"></div>'));

// create dropzone
$dropzoneContainer.find('#dropzone').dropzone({ url: '/upload', paramName: 'file_name' });

get Callback response from Server

Might be missing this somewhere in the library, but would like to see any response sent from a server you upload to. Some REST services respond with a JSON object for each file uploaded, and would like to have access to that.

Played with the complete event and dumping the object to the console, but don't see the response I am looking for.

myDropzone.on("complete", function(file) {
console.log(file);
});

Screen Shot 2013-03-04 at 2 53 58 PM

Standalone Version

Hi enyo,

Thank you for providing such a library. I was wondering if there is any way to install it without using of "component". Also, do we have to use jquery with it or not ?

Thank you in advanced, and sorry for my weak English :)

Fix Safari 5.1 support

Hello there,

I'm using Safari 5.1.7 on OS X 10.6.8 and the script says that it's just not supported. It's interesting because the supported browsers lists shows that if I have Safari 5+ that's fine.

dropzone

Not working in Firefox on Linux

Hey, I'm using Firefox 20.0a2 (Aurora) on Ubuntu, and on the demo site, drag and drop doesn't work. The box simply goes blank. Click to upload works fine. Drag and drop into a Chromium window works fine. In Firefox, I've tried disabling addons likely to break stuff (Flashblock, Ghostery, Adblock, HTTPS Everywhere), and even with all of those off, no luck.

Any thoughts? I'd assume Firefox is intended to be supported.

disable still allow few operations

In my simple test the ".disable()" will disable only the drag&drop, but still allow the "onclick" feature.
And it allow to delete ( "removedfile" ) also.
I have not tested other features.

Here part of my code:

..
$(document).ready(function(){
var myDropzone = $("#dropform").data("dropzone");
myDropzone.on("addedfile", function(file) {
myDropzone.disable();
});
..
form id="dropform" action="/target" class='dropzone square'
....

I discovered "dropzone" an hour ago, maybe I made errors

Loading DropzoneJS with RequireJS fails (No URL provided)

DropzoneJS throws an error before I init any dropzones (no .dropzone elements in HTML sources as well).

It seems Requirejs doesn't deal with Dropzone that well.

My RequireJS shim looks like:

dropzone: {
    deps: [ 'jQuery' ],
    exports: [ 'Dropzone' ]
}

Fallback Form

For sure we have to take a look on the fallback form. The first point is the form does not have the same "paramName" which will lead to upload the files somewhere else :D.

My second point is that that uploading process does not goes like the original upload, what I've meant is when the upload button got pressed the page navigate away to the provided URL without giving the same results !

DropzoneJS with requirejs fails ( undefined is not a function )

When loading Dropzonejs with RequireJS and having a *.dropzone element in the loaded HTML, this will result in an "Uncaught TypeError: undefined is not a function".

This snippet is the source of the error

  o.fn.dropzone = function(options) {
    return this.each(function() {
      return new Dropzone(this, options); // throws error: Dropzone is undefined
    });
  };

  o(function() {
    return o(".dropzone").dropzone(); // call method that throws error
  });

  Dropzone = (function(_super) { // definition of Dropzone

And it is clear that when o(".dropzone") has length > 0 on load, it will fail because Dropzone is undefined.

Use a provided fallback element if provided.

When there is already a .fallback element inside a dropzone, Dropzone should remove it on startup or leave it as fallback instead of creating a new one. This way Dropzone would also work if JS was completely disabled. #52

Work on the design of the dropzone itself.

  • Create a new "Drop files to upload" image
  • Create new success and error icons. I'm not happy with them now. The half transparent circle looks a bit childish
  • Decrease the border radius of the progress bar
  • Transform the stripes to just half transparent white tones so the color is entirely determined by the css.
  • Try out a few other ratios of the file image
  • Deploy them all

All images will be retina enabled.

Limit the number of files dropped

Hi, there is a way to stop dropzone accepting new files when a certain number where dropped?

I'm not talking about checking it in accept() and sending an error: this will create the thumbnail anyway.
What I'm saying is if there is a way to disable the file drop until one or more files in the dropzone are deleted (I've added to the thumbnails a button that, if pressed, remove the thumbnail and send a command via post-back for the server side deletion)?

Thanks and excuse me for my rough english.

Limiting of content types

Hi,

I would love the ability to be able to say that the dropzone only accepts, for example, image/jpeg, image/png, and image/gif.

I understand that I could implement this partially with one of the various callbacks but could I also prevent the upload from starting that way?

Thanks for your great work.
Leonard

Clickable area covers everything

When I add inputs for the form it looks like this
Untitled-3

But when I try to click on the "Select or Input" to enter any value, the clickable area start functioning, and a dialog window open for selecting the file.

So I think it better to add "noPropagation(e)" for form's children. Is that right ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.