I want to upload photo to one of the user's groups. Is it possible?
If it's not possible then is there any work-around for this?
Regards, Sanket
I want to upload photo to one of the user's groups. Is it possible?
If it's not possible then is there any work-around for this?
Regards, Sanket
Facebook has decent documentation about uploading to a group. You can post a picture object to the group API
https://developers.facebook.com/docs/reference/api/group/
Make sure to read the above link and read the CREATE section, also any needed permissions, etc. You code using the latest php-sdk should look similar to this...
//IF FILE UPLOAD
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 2000000)){
if ($_FILES["file"]["error"] > 0){
$error .= "Return Code: " . $_FILES["file"]["error"] . "<br />";
}else{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
$args = array('message' => $_GET['title']);
$args['image'] = '@' . realpath($_FILES["file"]["tmp_name"]);
$data = $facebook->api('/me/photos', 'post', $args);
$entry->details = $data['id'];
}
}
The important part is:
$data = $facebook->api('/me/photos', 'post', $args);
which uploads to the user, you can change this to post to a group something like this...
$data = $facebook->api('/GROUP_ID/photos', 'post', $args);