title: Video upload with Graph API from user's desktop
body: <p>i am trying to upload a local video to Facebook through the Graph API.
  Here is an example from Facebook:
  <a href="http://developers.facebook.com/blog/post/493/" rel="nofollow">http://developers.facebook.com/blog/post/493/</a>
  That works nice, and i get an JSON response after submitting the from.
  How can I get the respone ID, for use in, e.g. Javascript or directly as an GET-parameter on my server?
  I don't want to upload the video on an public accessable server and then redirect the video upload to Facebook by using curl or something like that.</p>
  
  <p>Has anyone an idea or an example of how i can get this to work?</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>Here is the example i used:</p>
  
  <pre><code>&lt;?php 
  $app_id = "YOUR_APP_ID";
  $app_secret = "YOUR_APP_SECRET"; 
  $my_url = "YOUR_POST_LOGIN_URL"; 
  $video_title = "YOUR_VIDEO_TITLE";
  $video_desc = "YOUR_VIDEO_DESCRIPTION";
  
  $code = $_REQUEST["code"];
  
  if(empty($code)) {
     $dialog_url = "http://www.facebook.com/dialog/oauth?client_id=" 
       . $app_id . "&amp;redirect_uri=" . urlencode($my_url) 
       . "&amp;scope=publish_stream";
      echo("&lt;script&gt;top.location.href='" . $dialog_url . "'&lt;/script&gt;");
  }
  
  $token_url = "https://graph.facebook.com/oauth/access_token?client_id="
      . $app_id . "&amp;redirect_uri=" . urlencode($my_url) 
      . "&amp;client_secret=" . $app_secret 
      . "&amp;code=" . $code;
  $access_token = file_get_contents($token_url);
  
  $post_url = "https://graph-video.facebook.com/me/videos?"
      . "title=" . $video_title. "&amp;description=" . $video_desc 
      . "&amp;". $access_token;
  
  echo '&lt;form enctype="multipart/form-data" action=" '.$post_url.' "  
       method="POST"&gt;';
  echo 'Please choose a file:';
  echo '&lt;input name="file" type="file"&gt;';
  echo '&lt;input type="submit" value="Upload" /&gt;';
  echo '&lt;/form&gt;';
  ?&gt;
  </code></pre>
  
  <p>Taken from this page: <a href="http://developers.facebook.com/blog/post/493/" rel="nofollow">http://developers.facebook.com/blog/post/493/</a></p>
  
  <p>This is the whole response i get from the form (JSON response):</p>
  
  <pre><code>{
      "id": "xxxxx19208xxxxx"
  }
  </code></pre>
  
  <p>The problem is that the JSON response is inline in the page.
  I thought to set a target in the form to an inline iframe but then i will not be able to access the JSON code.</p>