I have a function in php to upload several files through a stand alone script, the first ones upload fine but the last one that's 16GB around 20 minutes it gets interrumpted for no reason and the upload stops. The auth is already handled, so I don't know what may be causing this issue. Here's the code and the error that it outputs:
function insertFile($client,$service,$filePath,$name,$fId){
$file = new Google_Service_Drive_DriveFile();
$file->title = $name;
$parent = new Google_Service_Drive_ParentReference();
$parent->setId($fId);
$file->setParents(array($parent));
$chunkSizeBytes = 1 * 1024 * 1024;
$client->setDefer(true);
$request = $service->files->insert(
$file,
array(
'uploadType'=> 'resumable'
)
);
$finfo= finfo_open(FILEINFO_MIME_TYPE);
$media = new Google_Http_MediaFileUpload(
$client,
$request,
finfo_file($finfo, $filePath),
null,
true,
$chunkSizeBytes
);
$media->setFileSize(filesize($filePath));
$status = false;
$handle = fopen($filePath, "rb");
while (!$status && !feof($handle)) {
$chunk = fread($handle, $chunkSizeBytes);
$status = $media->nextChunk($chunk);
}
$result = false;
if($status != false) {
$result = $status;
}
fclose($handle);
$client->setDefer(false);
}
Error:
PHP Fatal error: Uncaught exception 'Google_IO_Exception' with message 'HTTP Error: Unape=resumable&upload_id=AEnB2UoRrzX46hJ02lIDkCJi03MFbE2KVP2LDCBOgnuiclONk3sBvSctZxW3NxsWt /libs/google-api-php-client/src/Google/IO/Stream.php
Stack trace:
#0 /libs/google-api-php-client/src/Google/IO/Abstract
#1 /libs/google-api-php-client/src/Google/Http/MediaF
#2 /root/name.php(199): Google_Http_MediaFileUpload->nextChunk(
#3 /root/name.php(102): insertFile(Object(Google_Client), /libs/google-api-php-client/src/Google/IO/Stream.php on l