How to upload block by block to Google Drive to avoid using high memory?
I saw such an explanation somewhere, but it didn’t give an example of how to do it yet.
Explanation of large memory usage: You read the file using the following line:
$data = file_get_contents(‘myfile.zip’);
This requires PHP to read the full file contents into memory ( in var $data ). It would be better to read the file blockwise e.g. in 4096 byte blocks and send them to network immediately.
Memory error occurs when uploading a 362 MB file.
I am using the code below
How should I change it to load it into the block mentioned in the above description?
I was able to upload large files very quickly using the code in the url below.
I want to check whether the uploaded file exists and if so, overwrite it.
Error message;
Fatal error: Uncaught Error: Call to undefined method GuzzleHttp\Psr7\Request::getFiles() in
The code given by the error;
if (count($results->getFiles()) > 0) {
Library;
$client = new Google\Client();
$client->setAuthConfig('**************.json');
$client->addScope(Google\Service\Drive::DRIVE);
$service = new Google\Service\Drive($client);
However, I get an error from the function that checks whether the file exists or not. What is the error here?