Skip to content

Instantly share code, notes, and snippets.

@mystix
Forked from miketaylr/HTML5 input attribute core tests
Created July 26, 2010 19:18
Show Gist options
  • Save mystix/491074 to your computer and use it in GitHub Desktop.
Save mystix/491074 to your computer and use it in GitHub Desktop.
HTML5 experiments
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core.js"></script>
<script>
Ext.onReady(function() {
Ext.get("wrapper").on({
drop: function(e) {
e.preventDefault();
var dt = e.browserEvent.dataTransfer,
file = dt.files[0],
formdata = new FormData(),
xhr = new XMLHttpRequest();
formdata.append("nickname", "Foooobar");
formdata.append("website", "http://hacks.mozilla.org");
formdata.append("media", file);
xhr.open("POST", "http://127.0.0.1:8085/"); // requires @shinchi's magic pubsub.js nodejs app
xhr.send(formdata);
},
dragover: function(e) {
e.preventDefault();
},
dragenter: function(e) {
e.preventDefault();
}
});
});
</script>
</head>
<body>
<div id="wrapper" style="height:100%;width:100%;border:1px solid #666666;"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment