Skip to content

Instantly share code, notes, and snippets.

@xem
Created June 17, 2014 17:41
Show Gist options
  • Save xem/cf8c21239c39f2c6ce27 to your computer and use it in GitHub Desktop.
Save xem/cf8c21239c39f2c6ce27 to your computer and use it in GitHub Desktop.
multiple file drop
<html ondrop="f(event);return!1"ondragover=return!1>
<script>
f=function(e){
r=new FileReader;
d=e.dataTransfer.files;
for(i=0;i<d.length;i++){
r.readAsArrayBuffer(d[i]);
}
r.onload=function(a){
console.log(r.result); // wat? If I drop multiple files, there's only one ArrayBuffer there (on FF) and it doesn't work at all (on chrome)
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment