title: Uploading file to specific folder using google drive api with PHP
body: <p>I am using google drive api to upload files,
  This is my code so far
  now the file upload to my root and I want to change the path to another folder,</p>
  
  <pre><code>   &lt;?php
          error_reporting(E_ALL);
          ini_set('display_errors', 1);
          require_once 'google-api-php-client/src/Google_Client.php';
          require_once 'google-api-php-client/src/contrib/Google_DriveService.php';
          $client = new Google_Client();
          // Get your credentials from the APIs Console
          $client-&gt;setClientId('***');
          $client-&gt;setClientSecret('***');
          $client-&gt;setRedirectUri('http://***');
          $client-&gt;setScopes(array('https://www.googleapis.com/auth/drive'));
  
          if(empty($_GET['code']))
          {
              $client-&gt;authenticate();
          }
  
          $myfile= "video.mp4";
          $type='video/mp4';
  
          $service = new Google_DriveService($client);
  
          // Exchange authorization code for access token
          $accessToken = $client-&gt;authenticate($_GET['code']);
          $client-&gt;setAccessToken($accessToken);
  
  
          //Insert a file
  
          $file = new Google_DriveFile();
          $file-&gt;setTitle('filename.mp4');
          $file-&gt;setDescription('A video');
          $file-&gt;setMimeType($type);
  
          $data = file_get_contents($myfile);
  
          $createdFile = $service-&gt;files-&gt;insert($file, array(
                'data' =&gt; $data,
                'mimeType' =&gt; $type,
              ));
  
          print_r($createdFile);
          echo "&lt;br /&gt;";
  </code></pre>
  
  <p>I tried few posts from stackoverflow
  and none of them worked for me I got error,
  Thanks in advance</p>