title: PHP SCRIPT Should Upload images too along with its description
body: <p>Following is my script which i want to use to update status on my facebook fanpage but its not working in a way that the uploaded image can't be viewed in the gallery of facebook fanpage kindly see this link ( <a href="http://radiations3.com/damn.jpg" rel="nofollow noreferrer">http://radiations3.com/damn.jpg</a> ) its a detailed screenshot of what exactly is happening by my script and what am i trying to do/want from my script. Kindly let me know what is wrong with my script and what should i do instead?</p>
  
  <pre><code> &lt;?php
  
  require 'src/facebook.php';
  
  $app_id = "332267477347";
  $app_secret = "xxxxxxxx";
  
  $facebook = new Facebook(array(
   'appId' =&gt; $app_id,
   'secret' =&gt; $app_secret,
   'cookie' =&gt; true,
   'fileUpload' =&gt; true,
  
  ));
  
  $facebook-&gt;setFileUploadSupport(true);  
  
  
  $user = $facebook-&gt;getUser();
  //echo $user;
  
  if(($facebook-&gt;getUser())==0)
  {
   header("Location:{$facebook-&gt;getLoginUrl(array('scope' =&gt; 'photo_upload,user_status,publish_stream,user_photos,manage_pages'))}");
   exit;
  }
  else {
  $accounts_list = $facebook-&gt;api('/me/accounts');
  echo "i am connected";
  }
    $valid_files = array('image/jpeg', 'image/png', 'image/gif');
  
  
  //to get the page access token to post as a page
  foreach($accounts_list['data'] as $account){
        if($account['id'] == 194458563914948){      // my page id =123456789
          $access_token = $account['access_token'];
          echo "&lt;p&gt;Page -- Access Token: $access_token&lt;/p&gt;";
          }
      }
  
  //posting to the page wall
  
  if (isset($_FILES) &amp;&amp; !empty($_FILES))
  {  
  $folder = "pak/".$_FILES['pic']['name'];
  $fold = 'http://snowdrop.com.pk/fb/'.$folder;
  echo $fold."&lt;br&gt;";
  if( move_uploaded_file($_FILES['pic']['tmp_name'], $folder) )
  {
  #Upload photo here
    $img = realpath($_FILES["pic"]["tmp_name"]);
  $attachment = array('message' =&gt; $_POST['textfield'],
                               'picture' =&gt; $fold,
                                  'access_token' =&gt; $access_token,
  
  
                  );
  $status = $facebook-&gt;api("/194458563914948/feed", 'post', $attachment);
  
  echo $status;
  var_dump($status);
  
   }
   else{
      echo 'Only jpg, png and gif image types are supported!';
  
  }
  }
  ?&gt;
  &lt;body&gt;
   &lt;!-- Form for uploading the photo --&gt;
   &lt;div class="main"&gt;
    &lt;p&gt;Select a photo to upload on Facebook Fan Page&lt;/p&gt;
    &lt;form method="post" action="" enctype="multipart/form-data"&gt;
    &lt;p&gt;Select the image: &lt;input type="file" name="pic" /&gt;
      &lt;br /&gt;
      &lt;label&gt;Description
      &lt;input type="text" name="textfield" id="textfield" /&gt;
      &lt;/label&gt;
    &lt;/p&gt;
    &lt;p&gt;&lt;input class="post_but" type="submit" value="Upload to my album" /&gt;&lt;/p&gt;
    &lt;/form&gt;
   &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/tX89F.jpg" alt="Detailed image of what my script is doing and what i want instead"></p>