通过PHP将任何文件上传到Google云端硬盘时出现问题, 另一个Process Listing文件,Children Listen,File details fork。
$client = new Google_Client();
$client->setApplicationName("File Upload Testing");
$client->setClientId('myID');
$client->setClientSecret('mySecret');
$client->setScopes(
array(
"https://www.googleapis.com/auth/drive",
"https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/drive.appdata",
"https://www.googleapis.com/auth/drive.apps.readonly",
));
$parent = new Google_Service_Drive_ParentReference();
$parent->setId("0B1OLO5r_T5znT3dRTUdNNGVxdms");
$file = new Google_Service_Drive_DriveFile();
$file->setParents(array($parent));
$file->setTitle("File.png");
$file->setDescription("File pnd desc");
$file->setMimeType("image/png");
$content = file_get_contents('images/resim.jpg');
try{
$file = $service->files->insert($file, array(
'data' => $content,
'mimeType' => 'image/png',
'uploadType' => 'multipart',
'fields' => 'id'));
printf("File ID: %s\n", $file->id);
} catch( Execution $e){
echo $e->getMessage();
}
图像在正确的路径!,我从数组文件中删除数据,上传过程成功,但空的不是内容,数据参数,返回总是404找不到!, 无法找到这个问题,有什么想法吗?