Uploading a photo to Facebook album from Windows server doesn't work
I've an app with which users can add pictures to their albums usin开发者_StackOverflow中文版g curl. I've coded it on my linux server and everything worked perfect. So I've uploaded the app into my clients server (which is windows) and photo upload doesn't work, I cant figure out why.
My code is
$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);
The only difference I can see between windows and linux is how you define image paths
The image path on windows is:
C:\Projects\appname\www\gallery\folder\picture.jpg
and on linux: /var/www/appname/gallery/folder/picture.jpg
Should I do something extra for windows?
精彩评论