【问题标题】:twitvid video upload issue "code": "1002", "msg": "No file specified to upload"twitvid 视频上传问题“code”:“1002”,“msg”:“没有指定要上传的文件”
【发布时间】:2012-05-16 08:53:01
【问题描述】:

我正在使用其官方 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"
}
}
}

提前谢谢...

【问题讨论】:

    标签: php video file-upload twitter


    【解决方案1】:

    我是 Marty,我编写了 twitvid 课程, 看起来,您可能只是将文件名发送到上传方法,而不是二进制文件数据?

    无论如何...自从该课程更新以来已经有一段时间了!

    我已将课程更新到 1.3 版

    可以在网站上找到:http://martin-gardner.co.uk/twitvid/

    它完全重写了该类,以符合 twitvid(众所周知的 Telly)对 api 和它们提供的功能所做的所有更改。

    下载该课程的最新版本,下载中包含一个演示页面,它是example page 的副本,您可以在其中看到用于上传的基本代码...

    【讨论】:

    • 我得到与 OP 相同的结果。尝试从 C# 中使用它。 POST /api/uploadAndPost HTTP/1.1 主机:im.twitvid.com 内容类型:multipart/form-data; boundary=635075109150857360 Content-Length: 32666 Expect: 100-continue Connection: Keep-Alive HTTP/1.1 100 Continue {"token":"AAAAAAAAAAAAAAAAAAAAABK1RQAAAAAAbHuJfDq3hPokzQiWFZnDqW7iN2o%3DcT5arBjqsKXOIYrv2sIljnlMbH4bSqxODw5EKoqgLcw"} Content-Disposition: form-data;名称="媒体"; filename="test.avi" Content-Type: video/avi Content-Transfer-Encoding: utf8
    • 顺便说一句,视频真的是32k,用于测试目的。
    • 一个示例 XML 或 json 请求会很棒。 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-10-04
    • 2012-03-28
    • 2014-03-11
    • 1970-01-01
    • 2022-08-17
    • 1970-01-01
    • 2012-04-17
    相关资源
    最近更新 更多