Facebook graph api上载照片错误

Facebook graph api上载照片错误,facebook,facebook-graph-api,upload,photo,Facebook,Facebook Graph Api,Upload,Photo,我有这个密码 require_once "facebook.php"; $app_id = "xxxxxx"; $app_secret = "xxxxx"; $facebook = new Facebook(array( "appId" => $app_id, "secret" => $app_secret, "cookie" => true )); $random_file = rand(); copy('http://alylores.x10.m

我有这个密码

require_once "facebook.php";
$app_id = "xxxxxx";
$app_secret = "xxxxx";
$facebook = new Facebook(array(
    "appId" => $app_id,
    "secret" => $app_secret,
    "cookie" => true
));

$random_file = rand();

copy('http://alylores.x10.mx/gd/clean2/pic.php', 'temp/'.$random_file.'.jpg');
$img = realpath("temp/".$random_file.".jpg");
// allow uploads
$facebook->setFileUploadSupport("http://" . $_SERVER['SERVER_NAME']);
// add a photo
$photo = $facebook->api("/".$_POST['fid']."/photos?access_token=".$_POST['foauth'],"POST",
    array(
            "source" => "@" . $img,
            "message" => "This photo came from my app."
    )
);



echo "<script type='text/javascript'>parent.iframe_callback();</script>";

unlink('temp/'.$random_file.'.jpg'); 
但是当我通过echo检查oauth_令牌是否存在时 oauth_令牌确实存在


有人能帮我解决这个问题吗?

array access\u token=>$\u POST[foauth],source=>@$img,message=>这张照片来自我的应用程序。我认为PHPSDK添加了访问令牌本身,因此您无需将其添加到请求路径。只要试试$facebook->api'/'.$\u POST['fid'].'photos'
array( "access_token" => $_POST["foauth"], "source" => "@" . $img, "message" => "This photo     came from my app." )
array( "access_token" => $_POST["foauth"], "source" => "@" . $img, "message" => "This photo     came from my app." )