Created
December 2, 2020 05:09
-
-
Save srmd-tl/ed524d50b982d7905e582a27563ed404 to your computer and use it in GitHub Desktop.
Upload files to google drive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the API client and construct the service object. | |
$client = self::getClient(); | |
$service = new Google_Service_Drive($client); | |
// Now lets try and send the metadata as well using multipart! | |
$file = new Google_Service_Drive_DriveFile(); | |
$file->setName("Hello World!"); | |
$result2 = $service->files->create( | |
$file, | |
array( | |
'data' => file_get_contents(request()->file), | |
'mimeType' => 'application/octet-stream', | |
'uploadType' => 'multipart' | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment