From 29f6b52dffc61323e2ce672319467c426365d711 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Wed, 18 Jan 2012 22:12:03 +0100 Subject: [PATCH] Use the filedrop jQuery plugin to allow for drag & drop uploading --- public/javascripts/plemp-ui.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/javascripts/plemp-ui.js b/public/javascripts/plemp-ui.js index 746d8c8..65e269d 100644 --- a/public/javascripts/plemp-ui.js +++ b/public/javascripts/plemp-ui.js @@ -37,6 +37,16 @@ $(document).ready(function() { }); }; + // For drag & drop file uploading via the filedrop jQuery plugin and HTML5. + $("body").filedrop({ url: '/draggables', + paramname: 'file', + data: { type: 'dnd' }, + maxfiles: 1, + maxfilesize: 50, + error: function(err, file) { console.log(err, file); }, + afterAll: function() { window.location.reload(true) } + }); + // Populate the canvas with the draggables. $.get("draggables", function(data) { $.each(data, function(drag_id, drag_info) {