Problem SCRIPT PHP z przekazywaniem przesłanego obrazu do funkcji facebook-> api

Mam ten kod i działa świetnie, jeśli zapewniam bezpośredni link do obrazu.

Tylko jeden problem nie jest w stanie przekazać przesłanego obrazu do facebook-> api (bez względu na to, czy jest ważny, czy nie) i następujące zawsze echo

echo 'Obsługiwane są tylko typy obrazów jpg, png i gif!';

usuwam nawet zaznaczenie typu obrazu i próbuję pobrać obraz z $ img = realpath ($ _ FILES ["pic"] ["tmp_name"]); ale $ img nic w nim nie zapisuje i wgrywa domyślnie pusty obraz na facebooku jako moja strona Proszę sprawdzić mój poniższy kod i dać mi znać, co jest nie tak z moim kodem i co powinienem zrobić zamiast przesłać zdjęcia

Internetowy link do następującego KODU:http://radiations3.com/facebook/1.php

<code> <?


require 'src/facebook.php';

$app_id = "364900470214655";
$app_secret = "xxxxxxxx";

$facebook = new Facebook(array(
 'appId' => $app_id,
 'secret' => $app_secret,
 'cookie' => true,
 'fileUpload' => true,
));

$user = $facebook->getUser();
//echo $user;

if(($facebook->getUser())==0)
{
 header("Location:{$facebook->getLoginUrl(array('req_perms' => 'user_status,publish_stream,user_photos,offline_access,manage_pages'))}");
 exit;
}
else {
$accounts_list = $facebook->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 "<p>Page Access Token: $access_token</p>";
        }
    }

//posting to the page wall

if (isset($_FILES) && !empty($_FILES))
{  
if( !in_array($_FILES['pic']['type'], $valid_files ) )
{
  echo 'Only jpg, png and gif image types are supported!';
 }
 else{
  #Upload photo here
  $img = realpath($_FILES["pic"]["tmp_name"]);
$attachment = array('message' => 'this is my message',
                'access_token'  => $access_token,
                'name' => 'This is my demo Facebook application!',
                'caption' => "Caption of the Post",
                'link' => 'example.org',
                'description' => 'this is a description',
                'picture' => '@' . $img,
                'actions' => array(array('name' => 'Get Search',
                                  'link' => 'http://www.google.com'))
                );
$status = $facebook->api('/194458563914948/feed', 'POST', $attachment);   // my page id =123456789
var_dump($status);
}
}
?>
<body>
 <!-- Form for uploading the photo -->
 <div class="main">
  <p>Select a photo to upload on Facebook Fan Page</p>
  <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data">
  <p>Select the image: <input type="file" name="pic" /></p>
  <p><input class="post_but" type="submit" value="Upload to my album" /></p>
  </form>
 </div>
</body>
</code>

questionAnswers(1)

yourAnswerToTheQuestion