2011-03-20 143 views
2

我有问题上传图片到用户相册的问题。无法上传图片API的图片Facebook

的应用要求 'req_perms'=> 'publish_stream,user_photos' 我这样做:

$fb = new Facebook(array(
     'appId' => FB_APP_ID, 
     'secret' => FB_SECRET_ID, 
     'cookie' => true, 
     '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); 

,但我所有的时间得到这个消息:

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

我m也发布饲料与$post = $fb->api('/me/feed', 'post', $recette_post_details); ,这是行得通......

有人有这个问题的想法?

谢谢。

回答

0

请检查您是否有权为您的应用程序发布照片“publish_stream”。

它通常还会将access_token数据放入请求中。 我不熟悉PHP,但我们可以得到和的access_token追加之后/我/照片/ =的access_token ...

我曾经做过这样的对AIR平台,通过插入access_token数据进入后的消息,在这种情况下,您的$ photo_details。

请尝试一下,让我知道它是否有效。