title: Google Drive PHP api, insert file to drive
body: <p>So basically the documentation in google developer is not updated to match the new version of their api. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;?php
  require_once 'autoload.php';
  
  $client = new Google_Client ();
  // Get your credentials from the console
  $client-&gt;setClientId ( 'CLIENT_ID' );
  $client-&gt;setClientSecret ( 'CLIENT_SECRET' );
  $client-&gt;setRedirectUri ( 'urn:ietf:wg:oauth:2.0:oob' );
  $client-&gt;setScopes ( array (
          'https://www.googleapis.com/auth/drive' 
  ) );
  
  $service = new Google_Service ( $client );
  
  $authUrl = $client-&gt;createAuthUrl ();
  
  // Request authorization
  print "Please visit:\n$authUrl\n\n";
  print "Please enter the auth code:\n";
  $authCode = trim ( fgets ( STDIN ) );
  
  // Exchange authorization code for access token
  $accessToken = $client-&gt;authenticate ( $authCode );
  $client-&gt;setAccessToken ( $accessToken );
  
  // Insert a file
  $file = new Google_Service_Drive_DriveFile ();
  $file-&gt;setTitle ( 'My document' );
  $file-&gt;setDescription ( 'A test document' );
  $file-&gt;setMimeType ( 'text/plain' );
  
  $data = file_get_contents ( 'document.txt' );
  
  $createdFile = $service-&gt;files-&gt;insert ( $file, array (
          'data' =&gt; $data,
          'mimeType' =&gt; 'text/plain' 
  ) );
  
  echo $createdFile;
  ?&gt;
  </code></pre>
  
  <p>And this is the error I get:</p>
  
  <pre><code>PHP Notice:  Undefined property: Google_Service::$files in D:\DATA\java\php workspace\Google Drive api test\quickstart.php on line 34
  PHP Fatal error:  Call to a member function insert() on a non-object in D:\DATA\java\php workspace\Google Drive api test\quickstart.php on line 34
  </code></pre>
  
  <p>This is the problematic line of code:</p>
  
  <pre><code>$createdFile = $service-&gt;files-&gt;insert
  </code></pre>
  
  <p>If you have any idea if I should be importing some other class or something please advise. Thank you.</p>