Skip to content

Instantly share code, notes, and snippets.

@ulizama
Created April 12, 2017 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ulizama/0e6da3648b36e57c12681f21d9ef7f28 to your computer and use it in GitHub Desktop.
Save ulizama/0e6da3648b36e57c12681f21d9ef7f28 to your computer and use it in GitHub Desktop.
Upload file example on Titanium
var xhr = Ti.Network.createHTTPClient();
xhr.onload = function(e) {
};
xhr.onerror = function(e){
};
xhr.open('POST', 'https://url');
var requestParams = {};
requestParams.avatar = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,'_new_avatar.jpg');
requestParams.requestTime = new Date();
xhr.send(requestParams);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment