title: Facebook Graph-API using curl - Create event with picture failed
body: <p>I have tested the codes from <a href="https://stackoverflow.com/questions/16070422/creating-a-facebook-event-and-publishing-a-cover-photo">this</a> and <a href="http://rvieiraweb.wordpress.com/2013/01/23/create-event-on-facebook-using-graph-api-curl/" rel="nofollow noreferrer">this</a> 
  but it doesn't work.</p>
  
  <p>The event is created successfully but the image is not published.</p>
  
  <p>Here is my actual code:</p>
  
  <pre><code>require_once '../admini/config.php';
  
  $t = getToken('appID', 'appSecret');
  
  $file = 'Koala.jpg';
  $arrData = array(
      'name' =&gt; 'Test Event',
      'start_time' =&gt; '2015-07-04', //ISO-8601 format - With Time  -     2012-07-04T19:00:00-0700
      //'end_time' =&gt; '', //optional
      'description' =&gt; 'Das erste Test-Event',
      'location' =&gt; 'Deggendorf', //Just a name
      'location_id' =&gt; '103091806397289', //place id - inserts a link to place fb page
      'ticket_url' =&gt; 'url', //URL to buy a ticket for the event
      'no_feed_story' =&gt; FALSE, //TRUE = dont display on page 
      'access_token' =&gt; 'token',
      'picture' =&gt; '@'. realpath($file),
      );
  $createUrl = 'https://graph.facebook.com/page_id/events';
  
  
  $test = fbcurl($createUrl, 'POST', $arrData); //Returns the event id
  
  echo '&lt;pre&gt;';
  print_r($test);
  echo '&lt;/pre&gt;';
  
  function fbcurl($url, $method, $fields = array(), $auth = array()){
  
  foreach($fields as $key =&gt; $value){
      if(!is_string($value)){
          $fields[$key] = json_encode($value);
      }
  }
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:multipart/form-data'));
  //  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
  //  if(count($auth)===2)
  //      curl_setopt($ch, CURLOPT_USERPWD, $auth['user'].':'.$auth['pass']);
  //  }
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  if(count($fields)&gt;0){
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields, null, '&amp;'));
  
  }
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_HEADER, 1);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  //curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
  //curl_setopt($ch, CURLOPT_TIMEOUT, 60);
  
  //curl_setopt($ch, CURLOPT_USERAGENT, 'facebook-php-3.2');
  //curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "Content-Type: multipart/form-data");
      //file_put_contents('fbcurllocal.txt', print_r(http_build_query($fields, null,        '&amp;'),      true)."\n".$url);
  $r = curl_exec($ch);
  curl_close($ch);
  if($r!=''){
      $p = explode("\r\n\r\nHTTP/", $r);
      $p = (count($p) &gt; 1 ? 'HTTP/' : '') . array_pop($p);
      list($h, $b) = explode("\r\n\r\n", $p, 2);
      return array('header' =&gt; $h, 'body' =&gt; $b);
  }else{
      return array('header' =&gt; '', 'body' =&gt; 'error');
  }
  }
  </code></pre>