I am trying to build an app which will upload a photo to a new album once you authorize and give public permission to it.
A cronjob (a php file which will be executed every 5 minutes) checks the time for each database entry and each entry time (it will be also saved in the database) which is over 24 hours ago will be updated and the user id will upload the photo again. But how I can upload a photo without that the user is on my site?
$permissions = $facebook->api("/".$user."/permissions");
if( array_key_exists('publish_stream', $permissions['data'][0]) ) {
$facebook->setFileUploadSupport(true);
$album_details = array(
'message'=> ''.$album_msg.'',
'name'=> ''.$album_name.''
);
$create_album = $facebook->api('/'.$user.'/albums', 'post', $album_details);
$album_uid = $create_album['id'];
$photo_details = array(
'message'=> ''.$photo_msg.''
);
$file='temp/'.$first_name.'_'.$worth.'.png';
$photo_details['image'] = '@' . realpath($file);
$upload_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);
}
With this code I upload a photo in the index.php. I tried to replace the "/me" with "/uid", but it told me everytime that I have no rights to upload a photo. Need help, really!