Shivomkara Chaturvedi
Shivomkara Chaturvedi

Reputation: 1697

twitvid video upload issue "code": "1002", "msg": "No file specified to upload"

I am uploading video on twitvid using its official php library. http://www.martin-gardner.co.uk/twitvid/twitvid.class.example.php#embedvideo

But when I upload a video it is return error like this.

include_once('twitvid.class.php');
$Tv = new Twitvid;
$Tv->username = '[email protected]';
$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);
}

and ehre is my upload video method

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);
        }

Please help me to get it resolve and upload video

My form is as below

<form method="post" enctype="multipart/form-data" action="">
<input name="file" type="file" />
<input name="submit" type="submit" value="Submit" />
</form>

and result is as below.

{
"rsp": {
"stat": "fail",
"err": {
"code": "1002",
"msg": "No file specified to upload"
}
}
}

Thanks in advance...

Upvotes: 0

Views: 444

Answers (1)

Marty
Marty

Reputation: 4657

I'm Marty, I wrote the twitvid class, it looks like, you could be just sending the file name to the upload method, and not the binary file data?

Anyway... its been a while since that class was updated!

I've updated the class to version 1.3

it can be found on the site: http://martin-gardner.co.uk/twitvid/

Its a total re-write of the class from the ground up to comply with all the changes twitvid(Telly as it will be known) has made to the api and features they offer.

download the latest version of the class, there's a demo page included in the download which is a copy of the example page where you can see the basic code used to upload...

Upvotes: 1

Related Questions