I've been trying this for the past few days but it seems I'm missing something: Well, I'm able to upload a photo to a users profile with the following code (I'm using cakephp with Nick Baker's facebook plugin):
$Fb = new FB();
FB::setFileUploadSupport(true);
$token = FB::getAccessToken();
//upload photo
$file= IMAGES.'badge.png';
$attachment = array(
'access_token'=> $token,
'name' => 'Album name',
'source' => '@'.$file
);
$fb_photo = FB::api('/me/photos','POST', $attachment);
I am able to upload the photo to a new album and I would like to redirect the user to set the uploaded photo as their facebook profile profile. I followed an answer posted on Stack Overflow but it appears i'm still missing something. I'm able to get the uploaded photo id using $fb_photo['id']
but i'm not able to get the photo link (i tried $fb_photo['link']
as suggested in a comment but it returns NULL). What am I doing wrong, or what I should I do to achieve a successful redirect? Thank you.