Small and very simple well commented example of a server-side PHP application where you can log in and insert files to Google Drive through their API. Also about creating parent folders and instering the file there.
- Go to Google Developers Console (https://console.developers.google.com) and create your own project.
- Enable Drive API and SDK for your project
- Go to APIs & Auth / Consent screen and name your project, also select an email address
- Go to APIs & Auth / Credentials and create a new OAuth 2.0 Client ID.
- Set your origins to localhost:yourporthere (or your domain)
- Set your Redirect URI to localhost:yourporthere/fileUpload.php (or your domain)
- Download the information in a JSON (press the button), and place it like {document root}/conf/googleClientId.json
- Comment, star and ask questions! And best of all, learn.