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";

  
	}

    $file_name is the name of the file as provided by the user, it is not the name of the uploaded (temporary) file on your server.

      This is what I get. I get the filename from html form.

      Uploading: video324
      Error uploading video324
      Server reported: Unable to locate file to upload.

        how am I supposed to get that? I use $_FILES[userfile][name] in php and the HTML form is below.

            <input type="text" name="title" placeholder="Title"></td> 
            <input type="text name="description" placeholder="Description" ></td> 
            <input type="file" name="userfile"> </td> 
            <input type="submit" name="submit" value="Upload"> 

          http://www.php.net/file-upload
          Here, I'll save you a click.
          http://www.php.net/features.file-upload.post-method

          $FILES['userfile']['name']
          The original name of the file on the client machine.
          $
          FILES['userfile']['type']
          The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted.
          $FILES['userfile']['size']
          The size, in bytes, of the uploaded file.
          $
          FILES['userfile']['tmp_name']
          The temporary filename of the file in which the uploaded file was stored on the server.
          $_FILES['userfile']['error']
          The error code associated with this file upload.

          Write a Reply...