title: Facebook Developer - Fatal error: Uncaught CurlException: 26: failed creating formpost data
body: <p>I read a lot on this platform, but no one seems to get the answer about my problem.</p>
  
  <p>There is my code:</p>
  
  <pre><code>$file= $str.".png";
  
  $facebook-&gt;setFileUploadSupport(true);
  
  $post_data = array(
    "message" =&gt; "my message."
  ); 
  $post_data[basename($file)] = '@' . dirname(__FILE__) . '/'.$file.'';
  $data = $facebook-&gt;api('/me/photos', 'post', $post_data);
  </code></pre>
  
  <p>I got a CurlException: 26 error.
  I even try with this one :</p>
  
  <pre><code>$post_data[basename($file)] = '@' . realpath($file);
  </code></pre>
  
  <p>But I got the same error.</p>
  
  <p>I first consider my problem was on $file.
  If I do an echo on this one, I a have the image name like this : 0gwP7eDAtb2X.png</p>
  
  <p>Now, if I test this code:</p>
  
  <pre><code>$post_data[basename($file)] = '@' . realpath(0gwP7eDAtb2X.png);
  </code></pre>
  
  <p>The picture is correctly uploaded on my wall.</p>