: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// Create a media file upload to represent our upload process.
$media = new Google_Http_MediaFileUpload($client, $request, $mime, null, true, $chunkSizeBytes);
$media->setFileSize($size);
// Upload the various chunks. $status will be false until the process is
while (!$status && !feof($fp)) {
elFinder::checkAborted();
// read until you get $chunkSizeBytes from TESTFILE
// fread will never return more than 8192 bytes if the stream is read buffered and it does not represent a plain file
// An example of a read buffered file is when reading from a URL
$chunk = $this->_gd_readFileChunk($fp, $chunkSizeBytes);
$status = $media->nextChunk($chunk);
// The final value of $status will be the data from the API for the object
// that has been uploaded.
$client->setDefer(false);
'data' => stream_get_contents($fp),
'fields' => self::FETCHFIELDS_GET,
if ($mode === 'insert') {
$obj = $this->service->files->create($file, $params);
$obj = $this->service->files->update($srcFile->getId(), $file, $params);
if ($obj instanceof Google_Service_Drive_DriveFile) {
return $this->_joinPath($parent, $obj->getId());
return $this->setError('GoogleDrive error: ' . $e->getMessage());
* @param string $path file path
* @author Dmitry (dio) Levashov
protected function _getContents($path)
list(, $itemId) = $this->_gd_splitPath($path);
$contents = $this->service->files->get($itemId, [
$contents = (string)$contents->getBody();
return $this->setError('GoogleDrive error: ' . $e->getMessage());
* Write a string to a file.
* @param string $path file path
* @param string $content new file content
* @author Dmitry (dio) Levashov
protected function _filePutContents($path, $content)
if ($local = $this->getTempFile($path)) {
if (file_put_contents($local, $content, LOCK_EX) !== false
&& ($fp = fopen($local, 'rb'))) {
$res = $this->_save($fp, $path, '', []);
file_exists($local) && unlink($local);
* Detect available archivers.
protected function _checkArchivers()
// die('Not yet implemented. (_checkArchivers)');
protected function _chmod($path, $mode)
* @param string $path archive path
* @param array $arc archiver command and arguments (same as in $this->archivers)
* @author Dmitry (dio) Levashov
* @author Alexey Sukhotin
protected function _unpack($path, $arc)
die('Not yet implemented. (_unpack)');
* Extract files from archive.
* @param string $path archive path
* @param array $arc archiver command and arguments (same as in $this->archivers)
* @author Dmitry (dio) Levashov,
* @author Alexey Sukhotin
protected function _extract($path, $arc)
die('Not yet implemented. (_extract)');
* Create archive and return its path.
* @param string $dir target dir
* @param array $files files names list
* @param string $name archive name
* @param array $arc archiver options
* @author Dmitry (dio) Levashov,
* @author Alexey Sukhotin
protected function _archive($dir, $files, $name, $arc)
die('Not yet implemented. (_archive)');