|
@@ 516-525 (lines=10) @@
|
| 513 |
|
$file = $this->getDriveFile($path); |
| 514 |
|
$this->client->setDefer($useChunking); |
| 515 |
|
$request = $this->service->files->update($file->getId(), $file, $params); |
| 516 |
|
} else { |
| 517 |
|
$file = new \Google_Service_Drive_DriveFile(); |
| 518 |
|
$file->setTitle(basename($path)); |
| 519 |
|
$file->setMimeType($mimetype); |
| 520 |
|
$parent = new \Google_Service_Drive_ParentReference(); |
| 521 |
|
$parent->setId($parentFolder->getId()); |
| 522 |
|
$file->setParents(array($parent)); |
| 523 |
|
$this->client->setDefer($useChunking); |
| 524 |
|
$request = $this->service->files->insert($file, $params); |
| 525 |
|
} |
| 526 |
|
|
| 527 |
|
if ($useChunking) { |
| 528 |
|
// Create a media file upload to represent our upload process. |
|
@@ 616-626 (lines=11) @@
|
| 613 |
|
} else { |
| 614 |
|
$result = $this->service->files->touch($file->getId()); |
| 615 |
|
} |
| 616 |
|
} else { |
| 617 |
|
$parentFolder = $this->getDriveFile(dirname($path)); |
| 618 |
|
if ($parentFolder) { |
| 619 |
|
$file = new \Google_Service_Drive_DriveFile(); |
| 620 |
|
$file->setTitle(basename($path)); |
| 621 |
|
$parent = new \Google_Service_Drive_ParentReference(); |
| 622 |
|
$parent->setId($parentFolder->getId()); |
| 623 |
|
$file->setParents(array($parent)); |
| 624 |
|
$result = $this->service->files->insert($file); |
| 625 |
|
} |
| 626 |
|
} |
| 627 |
|
if ($result) { |
| 628 |
|
$this->setDriveFile($path, $result); |
| 629 |
|
} |