Permalink
Browse files

added browser example (though a bit short)

  • Loading branch information...
1 parent ffbc3e0 commit 15e3b8fb66c215ffa0bdbba99c93471550c95a09 @coolaj86 committed Feb 20, 2011
Showing with 18 additions and 0 deletions.
  1. +18 −0 examples/browser-upload.js
View
@@ -0,0 +1,18 @@
+(function () {
+ "use strict";
+
+ function doUpload() {
+ var fileFields = $('[type=file]')[0],
+ fileList = fileFields.files,
+ file = fileList[0],
+ formData = new FormData(),
+ xhr = new XMLHttpRequest();
+
+ formData.append('upgrade', fileList[0]);
+
+ xhr.open("POST", "/upload", true);
+ xhr.send(formData);
+ }
+
+ doUpload();
+}());

0 comments on commit 15e3b8f

Please sign in to comment.