facebook api文件上传得到324错误

时间:2015-05-08 13:53:22

标签: php facebook facebook-graph-api

我正在使用php facebook api 4.0 。我正在使用下面的代码在我的时间轴上发布照片。

FacebookSession::setDefaultApplication($app_id, $app_sc);

$helper = new FacebookRedirectLoginHelper($url_page);
$loginUrl = $helper->getLoginUrl();
$session = new FacebookSession($access_token);
FacebookSession::enableAppSecretProof(false); 

if($session) {
  try {
    $response = (new FacebookRequest(
      $session, 'POST', '/me/photos', array(
        'source' => '@' . realpath('1.jpg'),
        'message' => 'message'
      )
    ))->execute()->getGraphObject();
    // If you're not using PHP 5.5 or later, change the file reference to:
    // 'source' => '@/path/to/file.name'
    echo "Posted with id: " . $response->getProperty('id');
  } catch(FacebookRequestException $e) {
    echo "Exception occured, code: " . $e->getCode();
    echo " with message: " . $e->getMessage();
  }
}

但我收到Exception occured, code: 324 with message: (#324) Requires upload file错误。我认为有一点是, fileupload support 应设置为on。但我不知道从哪里开启它。

0 个答案:

没有答案