public function updateFile(File $file) { $res = $this->getFile($file->getGoogleId()); $url = sprintf('%s/%s?uploadType=resumable', self::FILE_UPLOAD, $file->getGoogleId()); $body = ['name' => $file->getTitle()]; if ($file->getTargetFolder()) { $url .= '&addParents=' . $file->getTargetFolder(); if (!empty($res['parents'])) { $removeParents = implode(',', $res['parents']); $url .= '&removeParents=' . $removeParents; } } $response = $this->api->request($url, 'PATCH', ['Content-Type' => 'application/json; charset=UTF-8', 'X-Upload-Content-Type' => 'text/csv', 'X-Upload-Content-Length' => $file->getSize()], ['json' => $body]); $locationUri = $response->getHeaderLine('Location'); return $this->putFile($file, $locationUri); }