title: Upload file into particular folder on Google Drive using PHP and Drive API
body: <p>Hope this is an easy one... I want to upload file directly into a folder. I got folder ID and I have this code that uploads file in the root perfectly:</p>
  
  <pre><code>&lt;?php
  require_once 'get_access.php'; 
  
  require_once 'google-api-php-client/src/Google_Client.php';
  require_once 'google-api-php-client/src/contrib/Google_DriveService.php';
  
  $folder_id = '&lt;folder id&gt;';
  
  $client = new Google_Client();
  $client-&gt;setClientId('&lt;client_id&gt;');
  $client-&gt;setClientSecret('&lt;client_secret&gt;');
  $client-&gt;setRedirectUri('&lt;url&gt;');
  $client-&gt;setScopes(array('&lt;scope&gt;'));
  $client-&gt;setAccessToken($access);
  $client-&gt;setAccessType('offline');
  $client-&gt;refreshToken($refreshToken);
  $service = new Google_DriveService($client);
  
  //Insert a file
  $file = new Google_DriveFile();
  $file-&gt;setTitle('My document 123');
  $file-&gt;setDescription('A test document');
  $file-&gt;setMimeType('text/plain');
  
  $data = file_get_contents('document-2.txt');
  
  $createdFile = $service-&gt;files-&gt;insert($file, array(
        'data' =&gt; $data,
        'mimeType' =&gt; 'text/plain',
      ));
  
  echo '&lt;pre&gt;';
  var_dump($createdFile);
  echo '&lt;/pre&gt;';
  
  ?&gt;
  </code></pre>
  
  <p>What should I do here in order to upload this file into particular folder on user's drive?</p>
  
  <p>Thanks</p>