0

我正在使用以下代码将视频上传到用户墙:

if( isset($_POST['submitVideo']) ) {
   $img =  $_FILES['source']['name'];     
   $ret_obj = $facebook->api('/me/videos', 'POST', array(
      'source' => '@' . $img,
      'title' => "This is just a test",
      'description' => 'test9000',
      'privacy' => json_encode(array( 'value' => 'EVERYONE' )),
      )
   );
   echo '<pre>Video ID: ' . $ret_obj['id'] . '</pre>';
}

表单如下所示:

<form target="uploadTarget" enctype="multipart/form-data" method="POST">
   <input name="source" type="file">
   <input type="submit" value="Upload" name="submitVideo" />
</form>

我的问题是图像的来源。使用这个是否正确:

$img =  $_FILES['source']['name'];

应该是什么来源?我正在从本地计算机上传文件。
已编辑:
如果我对相同的表单使用以下模式并使用此“$post_url”作为操作怎么办:

$post_url = "https://graph-video.facebook.com/me/videos?"
        . "title=" . $video_title. "&description=" . $video_desc
        . "&access_token=". $access_token;

有用。但转到此“$post_url”页面,其中显示上传文件的 ID。如何使用该 ID 将其放入我的数据库?

4

1 回答 1

0
于 2013-07-22T10:06:02.460 回答