I need to add a photo to my user, by doing it from the web interface, I got the photo set to a field called photo
, but if I try to do the same thing programmatically from the mobile app it doesn't work.
photonativePath
is my photo url from camera or gallery.
Cloud.Users.update({
email: 'joeuser@mycompany.com',
first_name: 'joe',
last_name: 'user',
photo : Titanium.Filesystem.getFile(photonativePath),
custom_fields: {
favorite_color: 'blue',
age: 25
}
}, function (e) {
if (e.success) {
var user = e.users[0];
alert('Success:\n' +
'id: ' + user.id + '\n' +
'first name: ' + user.first_name + '\n' +
'last name: ' + user.last_name);
} else {
alert('Error:\n' +
((e.error && e.message) || JSON.stringify(e)));
}
});