change extension to upload message via xmlhttprequest

This commit is contained in:
Frédéric Péters 2014-02-27 13:12:26 +01:00
parent 1589c2c092
commit d931bebecd
1 changed files with 25 additions and 1 deletions

View File

@ -89,6 +89,30 @@ function(droppedItem) {
url[i++] = "&filename=ZimbraItems";
var getUrl = url.join("");
var oReq = new XMLHttpRequest();
oReq.open("GET", getUrl, true);
oReq.responseType = "blob";
oReq.onload = function(oEvent) {
var blob = oReq.response;
/* needs Access-Control-Allow-Origin: * header on the server */
var postUrl = 'http://test.ged.pfwb.be/@@importZimbra';
var sendReq = new XMLHttpRequest();
sendReq.open("PUT", postUrl, true);
sendReq.onload = function (oEvent) {
// Uploaded.
alert('done');
};
sendReq.send(blob);
};
oReq.send();
window.open(getUrl, "_blank");
};
@ -96,4 +120,4 @@ EmailDownloaderZimlet.prototype._getMsgIdsFromConv =
function(convSrcObj) {
convSrcObj.load();
return convSrcObj.msgIds;
};
};