


Java is a registered trademark of Oracle and/or its affiliates. For details, see the Google Developers Site Policies. Further readingĮxcept as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. If (array_key_exists('error', $accessToken)) (unsafe). $accessToken = $client->fetchAccessTokenWithAuthCode($authCode) Exchange authorization code for an access token. Printf("Open the following link in your browser:\n%s\n", $authUrl) $client->fetchAccessTokenWithRefreshToken($client->getRefreshToken()) We submit the data from this HTML form to getdata.php where the image is going to store in the database.You may also like preview image before upload. We make a HTML form with post method and save it with a name upload.html.

Refresh the token if possible, else fetch a new one. To Upload The Image In Database it takes only three steps:. If there is no previous token or it's expired. $accessToken = json_decode(file_get_contents($tokenPath), true) created automatically when the authorization flow completes for the first The file token.json stores the user's access and refresh tokens, and is Load previously authorized token from a file, if it exists. $client->setPrompt('select_account consent') $client->setAuthConfig('credentials.json') $client->setScopes(Google_Service_Drive::DRIVE_METADATA_READONLY) $client->setApplicationName('Google Drive API PHP Quickstart') * Google_Client the authorized client object Throw new Exception('This application must be run on the command line.')
