GithubHelp home page GithubHelp logo

greenbluebit / droploader Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 164 KB

Makes any html element into a dropzone. Gives access to the files locally, no need to save on server first.

JavaScript 60.00% HTML 40.00%

droploader's Introduction

Droploader

Makes any html element into a dropzone. Gives access to the files locally, no need to save on server first.

Needed a way to quickly load files in a server and start doing stuff with it but without having to first save the files anywhere, since my server is very limited. I know there is a jquery plugin called DropZone, but I could not figure out if it was possible to do this.

This plugin let's you easily make any area to listen to hovering over with files and dropping them, you can then also choose if you wish to preview the sent files (only works with images though).

In this repo, there's also my draggable plugin to make the element with images easily scroll on drag. It runs like this :

$(".drop_here").attachDropLoader();

This code handles the files after dropping them in the drop area :

 $(".drop_here").attachDropLoader({
    preview : true,
	postDrop: function(files) {
        // You can do whatever you want with the files here
        /*
           $.each( files, function (key, value) {
                    var reader = new FileReader();

                    reader.onload = function (e) {
                        image = new Image();
                        image.src = e.target.result;
                        var img = document.createElement('img');
                        img.src = e.target.result;

                        document.getElementsByTagName('body')[0].appendChild(img);

                    }
                    
                    reader.readAsDataURL(value);
            });
            */
           $(".drop_msg").css("display","none");
    }
});

These are the following options :

preview - True if you wish to display the images in the element afterwars as thumbnails.
postHover - A function which runs when the mouse is over the element with files.
beforeDrop - Before everything that the plugin handles when you drop the files.
postDrop - After you do the preview of the file and everything else on dropping the files.

The following images show the example that I made for this repo.

alt tag alt tag

droploader's People

Contributors

greenbluebit avatar

Watchers

James Cloos avatar  avatar  avatar

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.