Reputation: 43
I currently have the following code. But the graph api still return (#120) Invalid album id. If i look at $facebook_album or https://developers.facebook.com/tools/explorer/248099655226775/?method=GET&path=213152142082066 it shows an album. So the album does exist.
public function save_facebook(){
Site::debug();
$album_item = new Foto_Album_Item($this['navigatie_obj']['parent_id']);
// File upload activeren
Site::$facebook->setFileUploadSupport(true);
// Facebook album ophalen
$facebook_album = Site::$facebook->api('/'.$album_item['facebook_id']);
// Facebook als gebruiker gebruiken ipv als applicatie
Site::$facebook->setAccessToken( Facebook::$user_access_token );
$user_id = Site::$facebook->getUser();
$facebook_options = array(
'source' => '@'.realpath(Site::$serverpath['album'].$this['navigatie_obj']['parent_id'].'/'.$this['bestand']),
'access_token' => Facebook::$user_access_token,
);
$request_method = '/'.$album_item['facebook_id'].'/photos';
$return = false;
try {
$result = Site::$facebook->api($request_method,'POST',$facebook_options);
$options = array('facebook_id' => $facebook_id ? $this['facebook_id'] : $result['id']);
$return = parent::save($options);
} catch(Exception $e){
Log::error($e,__FILE__,__LINE__);
}
return $return;
}
Upvotes: 4
Views: 3018
Reputation: 3036
to be able to upload to an album that belongs to a page there are several things you should check (or change):
error message you get is obviously misleading
hope this helps
Upvotes: 4