Alex Rivera | Logout

How to upload a picture for an event using the Facebook Graph API?

Asked 2010-05-12T18:05:31.523
10

I would like to know how to add a picture to an event using the Facebook Graph API. I have seen this question and tried some variations on that theme, without any success. The official documentation doesn't seem to make any mention of it.

I'm using PHP for this particular project and I've looked at the PHP SDK source code, which is not helpful in any way. Requesting metadata for pictures using https://graph.facebook.com/eventid/picture?metadata=1&access_token... doesn't seem to be recognized, so no help there either.

Has anyone come across some example or documentation on how to do this? (don't care about which language it is in)

Edit
Report

1 Answer

1

I had the same problem, this code work for me:

// create the event
// ...

// upload the picture
$file = "pathtothefile";
$args[basename($file)] = '@' . realpath($file);
$data = $facebook->api('/'. $event_id, 'post', $args);

But sometimes I get "(#324) Missing or invalid image file" error

answered 2010-06-16T09:51:27.227

Your Answer