I have website create in PHP. Basically its send document kind project. Docuemt store in azure I will call and send it into a azure. Now I want to send in email as well as store in Google drive.
So it should be store to drive with public access. I have create following code. Its work properly I don't want any input from user.
$client->setAccessToken($_SESSION['accessToken']);
$service = new Google_DriveService($client);
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$file = new Google_DriveFile();
foreach ($files as $file_name) {
$file_path = 'files/'.$file_name;
$mime_type = finfo_file($finfo, $file_path);
$file->setTitle($file_name);
$file->setDescription('This is a '.$mime_type.' document');
$file->setMimeType($mime_type);
$service->files->insert(
$file,
array(
'data' => file_get_contents($file_path),
'mimeType' => $mime_type
)
);
}
finfo_close($finfo);
I want upload from azure URL using CURL or using API. When mail send its automatically upload to drive at the same time.
from PHP Upload PDF to Google Drive API
No comments:
Post a Comment