Upload photo from Titanium.Filesystem.applicationDataDirectory to Facebook
I know it's possible to upload a photo from Titanium.Media.openPhotoGallery.
But my app relies on saving the photos to the Titanium.Filesystem.applicationDataDirectory.
Is it possible to upload a picture from the filesystem to facebook?
Any suggestions would be appreciated.
2 Answers
-
Thanks for the comment.
Below is the code that uploads a photo from openPhotoGallery. I assume that it might be possible to use Titanium.Facebook.execute('facebook.photos.upload'…) somehow, but don't know how I would implement it.
function uploadPhoto()
{
Titanium.Media.openPhotoGallery({success:function(event) { b1.title = 'Uploading Photo...'; Titanium.Facebook.execute('facebook.photos.upload',{}, function(r) { if (r.success) { Ti.UI.createAlertDialog({title:'Facebook', message:'Your photo was uploaded'}).show(); } else { Ti.UI.createAlertDialog({title:'Facebook', message:'Error ' + r.error}).show(); } b1.title = 'Upload Photo'; }, event.media); }, cancel:function() { }, error:function(error) { }, allowEditing:true });
};
-
I'd like to know this too