I have a couple of problems using facebook graph api.
1). When i try to upload a photo i get the following error "(#324) Requires upload file".
$attachement = array(
'access_token'=> (...)',
'name' => 'uploaded foto',
'source' => 'C:\Documents and Settings\Username\Desktop\1.jpg'
);
$fb_foto = $fb->api('me/photos','POST',$attachement);
I am sure that source is correct. I have tried with a photo from the internet and not from mu local PC also.
2). How can i delete an object from facebook?. (a wall message for example). I have tried this: $fb->api('/post_id','POST',array('method'=> 'delete'));
But i get "unsupported POST request" error.
Any help would be appreciated.
EDIT: Here is the complete solution i found for upload photos to Facebook. You need to have the version 2.1.1 or above of PHP SDK
$fb = new Facebook(array(
'appId' => ...,
'secret' => ...,
'cookie' => true,
));
$fb->setFileUploadSupport(true);
$attachement = array(
'access_token'=> '...',
'name' => 'uploaded foto',
'source' => '@absolute_path_to_the_file'
);
$fb_foto = $fb->api('me/photos','POST',$attachement);