Created
February 2, 2015 18:40
-
-
Save rfaisal/eed03c9ed0ff7f254053 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MobileServiceClient.prototype.uploadBlob=function(blob, sasUrl, callBack){ | |
var xhr = Titanium.Network.createHTTPClient(); | |
xhr.setTimeout(this.REQUEST_TIMEOUT); | |
xhr.onload=function() { | |
var o = JSON.parse(this.responseText); | |
if(o && o['error']) callBack(o['error'],null); | |
else callBack(null,o); | |
}; | |
xhr.onerror= function(e) { | |
callBack(e,null); | |
}; | |
xhr.open("PUT", sasUrl); | |
xhr.setRequestHeader("Content-Type", "image/jpeg"); | |
xhr.send(blob); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment