diff --git a/demos.json b/demos.json index 55fc519..c018389 100644 --- a/demos.json +++ b/demos.json @@ -1,4 +1,14 @@ [ + { + "desc": "Drag and drop and XHR upload", + "url": "dnd-upload", + "tags": "file dnd xhr2", + "support": { + "live": "chrome firefox", + "nightly": "ie" + }, + "test": "typeof FileReader != 'undefined' && 'draggable' in document.createElement('span') && !!window.FormData && 'upload' in new XMLHttpRequest" + }, { "desc": "Simple class manipulation", "url": "classlist", diff --git a/demos/dnd-upload.html b/demos/dnd-upload.html new file mode 100644 index 0000000..1b8af00 --- /dev/null +++ b/demos/dnd-upload.html @@ -0,0 +1,110 @@ +Drag and drop, automatic upload + +
+
+
+ +

File API & FileReader API not supported

+

XHR2's FormData is not supported

+

XHR2's upload progress isn't supported

+

Upload progress: 0

+

Drag an image from your desktop on to the drop zone above to see the browser both render the preview, but also upload automatically to this server.

+
+ \ No newline at end of file diff --git a/demos/file-api.html b/demos/file-api.html index 8e99aa6..99d12f0 100644 --- a/demos/file-api.html +++ b/demos/file-api.html @@ -28,10 +28,12 @@ holder.ondrop = function (e) { var file = e.dataTransfer.files[0], reader = new FileReader(); reader.onload = function (event) { + console.log(event.target); holder.style.background = 'url(' + event.target.result + ') no-repeat center'; }; + console.log(file); reader.readAsDataURL(file); return false; }; - \ No newline at end of file + diff --git a/devnull.php b/devnull.php new file mode 100644 index 0000000..3eec00d --- /dev/null +++ b/devnull.php @@ -0,0 +1,3 @@ + \ No newline at end of file