Last active
August 29, 2015 14:02
-
-
Save xem/f2a98e4df3ae3076b8fd to your computer and use it in GitHub Desktop.
log the binary content of files dropped in the browser. also works for multiple files.
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 ondrop="f(event);return!1"ondragover=return!1> | |
<script> | |
f=function(e){ | |
d=e.dataTransfer.files; | |
for(i=0;i<d.length;i++){ | |
with(new FileReader){ | |
readAsArrayBuffer(d[i]); | |
onload=function(){console.log(new Uint8Array(result))}; | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment