我可以從我的服務器上傳一個大文件到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()',假設您使用標準的基於文件的會話,這會在上載運行時鎖定會話? –