1

Trying to upload videos using V3 API from a form. When specifying the path to the video I'm using $videoPath = file_get_contents($_FILES["file"]["name"]); I've also tried it with out the get_file_contents and it tells me it can't find the file. I must be missing something, is there a way to upload directly from a form post without having to upload it to my server, than upload it to YouTube?

Racil Hilan
  • 24,690
  • 13
  • 50
  • 55
  • I'm not trying to download a video from Youtube, I'm trying to use the insert method to upload a video. If I set it to a file on the server it works fine. Thanks – user2883109 Sep 21 '15 at 17:54
  • Related: http://stackoverflow.com/questions/14236502/upload-video-to-youtube-using-youtube-api-v3-and-php – The Onin Sep 23 '15 at 04:41

1 Answers1

0

You dont allow to download video files from youtube dirrectly. At first check path for $_FILES["file"]["name"].

I recommend to use code if you need get information about video. After you may parse data and get images/video etc.

public function getParseVideo($code = null){
    $key = "your code";
      if(!empty($code)){
           $data = file_get_contents("https://www.googleapis.com/youtube/v3/videos?   key=".$key."&part=snippet&id=".$code);
                echo $json = json_decode($data);
            }
        }
Ahmed
  • 255
  • 1
  • 6
  • 18