Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (37 sloc) 1.13 KB
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<style type="text/css" media="screen">
#dropzone { margin: 2em; background: red; color: #FFF; padding: 2em; }
</style>
<script type="text/javascript" charset="utf-8">
window.addEventListener("load", function(){
var element = document.getElementById("dropzone");
element.addEventListener("dragenter", function(e){
e.stopPropagation();
e.preventDefault();
});
element.addEventListener("dragover", function(e){
e.dataTransfer.dropEffect = "copy";
e.stopPropagation();
e.preventDefault();
});
element.addEventListener("drop", function(e){
var files = e.dataTransfer.files;
for (var i=0; i < files.length; i++)
alert("Dropped " + files[i].name);
});
// Prevent default behaviour
document.body.addEventListener("dragover", function(e){
e.stopPropagation();
e.preventDefault();
return false;
});
});
</script>
</head>
<body>
<div id="dropzone">Drop files on me</div>
</body>
</html>
Something went wrong with that request. Please try again.