Created
October 9, 2009 22:36
-
-
Save garyhodgson/206425 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script> | |
function dodrop(event) | |
{ | |
var dt = event.dataTransfer; | |
var files = dt.files; | |
var count = files.length; | |
output("File Count: " + count + "\n"); | |
for (var i = 0; i < count; i++) { | |
output(" File " + i + ":\n"); | |
var types = dt.mozTypesAt(i); | |
for (var t = 0; t < types.length; t++) { | |
output(" " + types[t] + ": "); | |
try { | |
var data = files[i]; | |
output("(" + (typeof data) + ") : <" + data + " > " + data.fileName + " " + data.fileSize + "\n"); | |
} catch (ex) { | |
output("<<error>>\n"); | |
dump(ex); | |
} | |
} | |
} | |
} | |
function output(text) | |
{ | |
document.getElementById("output").textContent += text; | |
dump(text); | |
} | |
</script> | |
</head> | |
<body> | |
<div id="output" style="min-height: 100px; white-space: pre; border: 1px solid black;" | |
ondragenter="document.getElementById('output').textContent = ''; event.stopPropagation(); event.preventDefault();" | |
ondragover="event.stopPropagation(); event.preventDefault();" | |
ondrop="event.stopPropagation(); event.preventDefault(); dodrop(event);"> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment