title: Uploading image to Facebook by using Curl PHP
body: <p>I read the instructions: <a href="https://stackoverflow.com/questions/2718610/upload-photo-to-album-with-facebooks-graph-api/7306889#7306889">Upload Photo To Album with Facebook&#39;s Graph API</a></p>
  
  <p>But although I follow the instructions, the image can't be uploaded to FB. Here is my code. Please help me.</p>
  
  <pre><code>$graph_url = "https://graph.facebook.com/". $album_id . "/photos?access_token=" . $access_token;
  
  $ch = curl_init();
      curl_setopt($ch, CURLOPT_HEADER, false);
      curl_setopt($ch, CURLOPT_VERBOSE, 0);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_URL, $post_url );
  
  $post_array = array(
          "source" =&gt;"@". realpath("photo.jpg"),
          "message"=&gt;"Upload " . date('Y-m-d h:i:s') 
      );
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_array); 
      $response = curl_exec($ch);
  $graph_url = "https://graph.facebook.com/". $album_id . "/photos?access_token=" . $access_token;
  
  $ch = curl_init();
      curl_setopt($ch, CURLOPT_HEADER, false);
      curl_setopt($ch, CURLOPT_VERBOSE, 0);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_URL, $post_url );
  
  $post_array = array(
          "source" =&gt;"@". realpath("photo.jpg"),
          "message"=&gt;"Upload " . date('Y-m-d h:i:s') 
      );
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_array); 
      $response = curl_exec($ch);
  </code></pre>