0

Im trying to upload to a facebook fan page album. I have permissions and the access token (I can post to the wall).

This is my code:

$img = realpath('/var/www/publish_facebook/images/corn.jpg');

$args = array(
          'message' => 'testing',
          'source' => '@' . $img,
          'aid' => $album_id,
          'no_story' => 1,
          'access_token' => $fanpage_token
        );

try
{
    var_dump($args);
    $photo = $facebook->api($album_id . '/photos', 'post', $args);
} 
catch (FacebookApiException $e) 
{
     return 'Error facebookservice'.$e;
}

And I get the error:

Error facebookserviceOAuthException: (#324) Requires upload file

When I remove the @ before the image path I get the same error. If I use source or image as the parameter, I still get the same error. The var_dump result is:

array(5) { ["message"]=> string(7) 
            "testing" ["source"]=> string(68) "@http://www.blog.webintelligence.ie/publish_facebook/images/corn.jpg" 
            ["aid"]=> string(15) "531304096943185" 
            ["no_story"]=> int(1) 
           ["access_token"]=> string(198) <page access token>
        }

Any ideas?

4

1 回答 1

0

参数必须命名source,而不是图像,

并且您还必须将文件上传支持设置为 true来初始化 PHP SDK 。

于 2013-08-31T19:52:34.687 回答