title: Upload photos to Facebook Album from an app
body: <p>I've used </p>
  
  <pre><code>'req_perms' =&gt; 'publish_stream,status_update'
  </code></pre>
  
  <p>The error I'm getting is</p>
  
  <blockquote>
    <p>Fatal error: Uncaught CurlException: 26: failed creating formpost data thrown in facebook.php on line 589</p>
  </blockquote>
  
  <p>My upload code:</p>
  
  <pre><code>$facebook-&gt;setFileUploadSupport(true);
  $args = array('message' =&gt; 'My Friend\'s');
  $args['image'] = '@' . realpath('http://mysite/img/img.jpg');
  $data = $facebook-&gt;api('/me/photos', 'post', $args);
  print_r($data);
  </code></pre>
  
  <p>I just want to upload the photo to an existing album or already created album. What would working code be?</p>
  
  <p>Another code</p>
  
  <pre><code>$photo_details = array('message'=&gt;$_REQUEST['arttitle'],'source'=&gt; '@' . realpath( $_FILES[file]tmp_name]));
  $facebook-&gt;api('/me/photos','POST',$photo_details);
  </code></pre>
  
  <p>results in </p>
  
  <blockquote>
    <p>Fatal error: Uncaught OAuthException: (#324) Requires upload file thrown in facebook.php on line 522</p>
  </blockquote>
  
  <p>I tried other answers from Stack&nbsp;Overflow, but none of them worked in my case.</p>