I upload file like this:
if (isset($_FILES[$name])) {
$service = new Google_DriveService($client);
//Insert a file
$file = new Google_DriveFile();
$file->setTitle($_FILES[$name]['name']);
$file->setMimeType($_FILES[$name]['type']);
$file->setParents(array('imgs'));
$insertedFile = $service->files->insert($file, array(
'data' => file_get_contents($_FILES[$name]['tmp_name']),
'mimeType' => $_FILES[$name]['type']
));
return $insertedFile;
}
Get insertedFile
as this:
Array
(
[kind] => drive#file
[id] => 1sASTlgG7IFzcZyTUihp53uJbppFtxLs_GK_V2jYwapE
[etag] => "vGmlhiWxP02tugPmRvLynwC_A0Y/MTM2NjE4NTYyNzQwOQ"
[selfLink] => https://www.googleapis.com/drive/v2/files/1sASTlgG7IFzcZyTUihp53uJbppFtxLs_GK_V2jYwapE
[alternateLink] => ...
But when i go to selfLink, i get an error
{
...
"code": 403,
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
}
}
What is the correct way to get uploaded file without any kind of authorization? Looks like file is only available through the API.