我正在使用其官方 php 库在 twitvid 上上传视频。 http://www.martin-gardner.co.uk/twitvid/twitvid.class.example.php#embedvideo
但是当我上传视频时,它会返回这样的错误。
include_once('twitvid.class.php');
$Tv = new Twitvid;
$Tv->username = 'iphoneteamds@gmail.com';
$Tv->password = 'ds#123456';
$login_test = $Tv->authenticate_it();
$Tv->token="62BE4CB70D9A49100A1C6A175C8ED3E5";
if($_FILES['file']){
pr($_FILES);
$myfile = $_FILES['file'];
//$myfile = fread(fopen($_FILES ['file']['tmp_name'], 'r'), $_FILES['file']['size']);
$my_upload = $Tv->upload_video($myfile,"test","test1");
pr($my_upload);
}
ehre 是我上传视频的方法
function upload_video($media, $message="", $title="", $format='json', $playlist_id="", $vidResponse_parent="", $yt_username="", $yt_password="", $user_tags="", $geo_latitude="", $geo_longitude="", $tags="", $description="")
{
$request = 'https://im.twitvid.com/api/upload ';
if($this->token !== ""){
$postargs = "token=".$this->token."&format=".$format."&message=".$message."&playlist_id=".$playlist_id."&vidResponse_parent=".$vidResponse_parent."&yt_username=".$yt_username;
$postargs.= "&yt_password=".$yt_password."&user_tags=".$user_tags."&geo_latitude=".$geo_latitude."&geo_longitude=".$geo_longitude."&tags=".$tags;
$postargs.= "&description=".$description."&title=".$title."&media=".$media;
}else {
$postargs = "username=".$this->username."&password=".$this->password."&format=".$format."&message=".$message."&playlist_id=".$playlist_id."&vidResponse_parent=".$vidResponse_parent."&yt_username=".$yt_username;
$postargs.= "&yt_password=".$yt_password."&user_tags=".$user_tags."&geo_latitude=".$geo_latitude."&geo_longitude=".$geo_longitude."&tags=".$tags;
$postargs.= "&description=".$description."&title=".$title."&media=".$media;
}
return $this->process($request,$postargs);
}
请帮我解决并上传视频
我的表格如下
<form method="post" enctype="multipart/form-data" action="">
<input name="file" type="file" />
<input name="submit" type="submit" value="Submit" />
</form>
结果如下。
{
"rsp": {
"stat": "fail",
"err": {
"code": "1002",
"msg": "No file specified to upload"
}
}
}
提前致谢...