我可以从我的服务器上传一个大文件到Google驱动器,但是当我从我的服务器上传一个文件时,只要进程不能访问我的网站没有完成。你知道我能做些什么吗?上传一个大的PHP文件到Google Drive
还有就是我对我的上传脚本:
set_time_limit(0);
$file = new Google_Service_Drive_DriveFile();
$file->title = "title";
$chunkSizeBytes = 1 * 1024 * 1024;
// Call the API with the media upload, defer so it doesn't immediately return.
$client->setDefer(true);
$request = $service->files->insert($file);
// Create a media file upload to represent our upload process.
$media = new Google_Http_MediaFileUpload(
$client,
$request,
mime_content_type($filePath),
null,
true,
$chunkSizeBytes
);
$media->setFileSize(exec('stat -c %s "'.$filePath.'"'));
// Upload the various chunks. $status will be false until the process is
// complete.
$status = false;
$handle = fopen($filePath, "rb");
while (!$status && !feof($handle)) {
$chunk = fread($handle, $chunkSizeBytes);
$status = $media->nextChunk($chunk);
}
// The final value of $status will be the data from the API for the object
// that has been uploaded.
$result = false;
if($status != false) {
$result = $status;
}
你得到什么错误? –
你的意思是网站不会加载? “无法访问”是什么意思? –
在上传处理程序中尝试'session_write_close()',假设您使用标准的基于文件的会话,这会在上载运行时锁定会话? –