开发者

Cannot upload picture with graph API Facebook

I've got a problem to upload a picture to a user album's.

The application ask for 'req_perms' => 'publish_stream,user_photos' I'm doing this :

$fb = new Facebook(array(
       'appId'  => FB_APP_ID,
       'secret' => FB_SECRET_ID,
       'cookie' => tru开发者_运维百科e,
       'fileUpload' => true,
    ));
$fb->setFileUploadSupport(true);

$photo_details = array(
    'message'=> 'Retrouve cette recette surhttp://apps.facebook.com/betaaa'
);

$file='/img/bar.png'; //Example image file
$photo_details['image'] = '@'.realpath($file);
echo '@'.realpath($file);

//echo   '/me/'.$album_uid.'/photos';
$upload_photo = $fb->api('/me/photos', 'post', $photo_details);

but I all the time get this message:

Fatal error: Uncaught OAuthException: (#1) An unknown error occurred thrown

I'm also publishing feeds with $post = $fb->api('/me/feed', 'post', $recette_post_details); and this is working...

Somebody has an idea about this problem?

Thanks.


Please check whether you have permission to post photo "publish_stream" for your application.

Or

It's usually about putting access_token data into the request as well. I'm not familiar with PHP, but we could get access_token and append it after /me/photos/access_token=...

I have done like this on AIR platform, by insert access_token data into the post message, in this case your $photo_details.

Please try it, let me know if it works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜