Skip to content

Commit

Permalink
generate input file element on dropFunctio.
Browse files Browse the repository at this point in the history
  • Loading branch information
yoya committed May 21, 2017
1 parent f45936d commit 84fa08f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,15 @@ function dropFunction(target, func, datatype) {
return false;
}, false);

// no pastable environment.
var input = document.createElement("input");
input.setAttribute("type", "file");
// input.setAttribute("style", "visibility:hidden;");
var body = document.body;
body.appendChild(input);
input.addEventListener("change", function(e) {
var file = e.target.files[0];
console.log(file);
fileReadEvent(file, func);
});
}

0 comments on commit 84fa08f

Please sign in to comment.