I am having a hard time to upload a video to vimeo server. Can you guys please help me?
$file_name =$_FILES['userfile']['name'];
$file_ext = strtolower(end(explode('.',$_FILES['userfile']['name'])));
//Acceptable file formats by Vimeo
$formats = array("MP4","MOV","WMV","AVI","FLV");
if(in_array($file_ext, $formats) === FALSE ){
$resp['code'] = 415;
$resp['msg'] = "Invalid file error";
}
//
// ----------------------------------------------------------------------------------
// Instantiate the library with your client id, secret and access token
$lib = new Vimeo($clientId, $clientSecret, $accessToken);
echo 'Uploading: ' . $file_name . "\n";
//
// ----------------------------------------------------------------------------------
// Upload the file with tus method and include the video title and description
try{
$respond = $lib->upload($file_name, array(
'name' => $title,
'description' => $description,
'privacy' => [ 'view' => 'anybody']
));
// Get the metadata response from the upload and log out the Vimeo.com url
$metadata = $lib->request($respond . '?fields=link');
echo '"' . $file_name . ' has been uploaded to ' . $metadata['body']['link'] . "\n";
// Make an API call to see if the video is finished transcoding.
$metadata = $lib->request($respond . '?fields=transcode.status');
echo 'The transcode status for ' . $respond . ' is: ' . $respond['body']['transcode']['status'] . "\n";
}