从Windows服务器上传照片到Facebook相册不起作用

时间:2011-10-02 13:05:39

标签: php facebook upload

我有一个应用程序,用户可以使用curl将图片添加到他们的相册。 我在我的linux服务器上编写了它,一切都很完美。所以我已将应用程序上传到我的客户端服务器(这是Windows),照片上传不起作用,我无法弄清楚原因。

我的代码是

$file = $img_path;
$args = array(
    'message' => APP_TITLE,
);
$args[basename($file)] = '@' . $file;
$ch = curl_init();
$url = 'https://graph.facebook.com/' . $album_id . '/photos?access_token=' . $access_token;


curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
$data = curl_exec($ch);
//returns the photo id
$res = json_decode($data,true);

我可以在windows和linux之间看到的唯一区别是你如何定义图像路径 Windows上的图像路径是:     C:\Projects\appname\www\gallery\folder\picture.jpg

并在linux上:/var/www/appname/gallery/folder/picture.jpg

我应该为Windows做一些额外的事吗?

0 个答案:

没有答案