我上傳的文件是這樣的:如何上傳文件公開,未經授權下載可用嗎?
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;
}
獲取insertedFile
就象這樣:
Array
(
[kind] => drive#file
[id] => 1sASTlgG7IFzcZyTUihp53uJbppFtxLs_GK_V2jYwapE
[etag] => "vGmlhiWxP02tugPmRvLynwC_A0Y/MTM2NjE4NTYyNzQwOQ"
[selfLink] => https://www.googleapis.com/drive/v2/files/1sASTlgG7IFzcZyTUihp53uJbppFtxLs_GK_V2jYwapE
[alternateLink] => ...
但是,當我去selfLink,我得到一個錯誤
{
...
"code": 403,
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
}
}
什麼是正確的方法無需任何授權即可上傳文件?看起來像文件只能通過API獲得。
該錯誤看起來像你超過了最大值。上傳限制。 –
也許你超過了一些限制,不能再從你的賬戶下載任何文件而無需進行身份驗證? –
不,我沒有豐富的上傳限制 – Luciuz