ajdavis/file-uploader — comment on commit 301e5b715ca0c240cafd01b555b75d1104363017
File:  line 0
By mngsk:

This is another version, this time following the same conventions as getName and getSize:

--- fileuploader.js	2011-12-09 13:01:31.000000000 -0600
+++ js/fileuploader.js	2011-12-09 11:03:57.000000000 -0600
@@ -1159,6 +1159,10 @@
var file = this._files[id];
return file.fileSize != null ? file.fileSize : file.size;
},
+ getType: function(id){
+ var file = this._files[id];
+ return file.fileType != null ? file.fileType : file.type;
+ },
/**
* Returns uploaded bytes for file identified by id
*/
@@ -1172,7 +1176,8 @@
_upload: function(id, params){
var file = this._files[id],
name = this.getName(id),
- size = this.getSize(id);
+ size = this.getSize(id),
+ type = this.getType(id);

this._loaded[id] = 0;

@@ -1200,7 +1205,7 @@
xhr.open("POST", queryString, true);
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xhr.setRequestHeader("X-File-Name", encodeURIComponent(name));
- xhr.setRequestHeader("Content-Type", "application/octet-stream");
+ xhr.setRequestHeader("Content-Type", type);
xhr.send(file);
},
_onComplete: function(id, xhr){