Take the 2-minute tour ×

I'm starting to use facebook graph api to create events with javascript! It works very well except for image. I create event in this way:

    name: 'TEST',
    start_time: '2011-12-01T15:00:00',
    end_time: '2011-12-02T15:00:00',
        location: 'here',
    picture: 'http://www.ostianews.it/wp-content/uploads/2010/06/rock.jpg'              

idOwner and access_token are two variables. In this way it creates me event without picture. How can I load picture on my event???? Have a good evening!!! Bye!

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You can consider using the following solution

$photo = './images/logo-square.png';// Must be an image on your server
$event_info = array(
"privacy_type" => "OPEN",
"name" => "Event Title",
"page_id" => YOUR_PAGE_ID,
"start_time" => "2012-01-22 09:00:00",
"end_time" => "2012-02-22 09:00:00",
"description" => "Event Description"

//The key part - The path to the file with the CURL syntax
$event_info[basename($photo)] = '@' . realpath($photo);
//Make the call and get back the event ID
$result = $this->facebook->api($this->id.'/events','post',$event_info);

If you absolutely want to do in JS, make an ajax to execute this code and return the Event Id ($result["id"])

I did it and it worked perfectly.

ps: Thanks to Adam Heath who found the solution at Attach image to Facebook event (php sdk, rest or graph api)

share|improve this answer
add comment

Your Answer


