function uploadImage(filename){
//load the file into a blob
var oReq = new XMLHttpRequest();
oReq.open("GET", "file://"+filename, true);
oReq.responseType = "arraybuffer";
oReq.onload = function(oEvent) {
var blob = new Blob([oReq.response], {type: "image/jpg"});
Log("loaded");
var client = new XMLHttpRequest();
var formData = new FormData();
/* Add the file */
formData.append("file", blob,"myfile.jpg");
client.onload = function () {
if (client.status === 200) {
//for deviantsart, this is the url of the image
Log(client.responseText);
}
};
client.send(formData); /* Send to server */
};
oReq.send();
return;
}