I have gotten the photo upload function to work with this code,
This seems to be a bug with the Graph API. See this http://forum.developers.facebook.com/viewtopic.php?id=59063 (can't post links, yet)
Follow the simple Get login url with
$data['url'] = $this->facebook->getLoginUrl(array('scope'=>'publish_stream,read_stream,user_likes,user_photos,manage_pages'));
this will let you post photo and add album in fanpage. Get access token for
$accounts = $this->facebook->api('/'.$PAGE_ID.'?fields=access_token', 'get', array('access_token' => $access_token));
$page_access_token = $accounts['access_token'];
Create album with other detail
$album_details = array(
'message'=> 'Test album',
'name'=> $today ,//should be unique each time,
'access_token'=>$page_access_token
);
$album_created = $this->facebook->api('/'.$PAGE_ID.'/albums', 'post', $album_details);
Upload photo to a particualar fanpage album
$photo = $this->facebook->api('/'.$album_id.'/photos', 'POST', array(
'source' => "@"."@".realpath(BASEPATH."../".$photopath),
'message' => 'new photo',
'access_token' => $page_access_token,
'no_story' => 0
)
);
//print_r( $album_created['id'] );
And change the path as you wish Happy coding
This code works aweesome in this site....why downvoted.?You can post photos to fanpage if you are owner of that page.I have a working copy of that application.