|
@@ 533-542 (lines=10) @@
|
| 530 |
|
$file = $this->getDriveFile($path); |
| 531 |
|
$this->client->setDefer($useChunking); |
| 532 |
|
$request = $this->service->files->update($file->getId(), $file, $params); |
| 533 |
|
} else { |
| 534 |
|
$file = new \Google_Service_Drive_DriveFile(); |
| 535 |
|
$file->setTitle(basename($path)); |
| 536 |
|
$file->setMimeType($mimetype); |
| 537 |
|
$parent = new \Google_Service_Drive_ParentReference(); |
| 538 |
|
$parent->setId($parentFolder->getId()); |
| 539 |
|
$file->setParents(array($parent)); |
| 540 |
|
$this->client->setDefer($useChunking); |
| 541 |
|
$request = $this->service->files->insert($file, $params); |
| 542 |
|
} |
| 543 |
|
|
| 544 |
|
if ($useChunking) { |
| 545 |
|
// Create a media file upload to represent our upload process. |
|
@@ 633-643 (lines=11) @@
|
| 630 |
|
} else { |
| 631 |
|
$result = $this->service->files->touch($file->getId()); |
| 632 |
|
} |
| 633 |
|
} else { |
| 634 |
|
$parentFolder = $this->getDriveFile(dirname($path)); |
| 635 |
|
if ($parentFolder) { |
| 636 |
|
$file = new \Google_Service_Drive_DriveFile(); |
| 637 |
|
$file->setTitle(basename($path)); |
| 638 |
|
$parent = new \Google_Service_Drive_ParentReference(); |
| 639 |
|
$parent->setId($parentFolder->getId()); |
| 640 |
|
$file->setParents(array($parent)); |
| 641 |
|
$result = $this->service->files->insert($file); |
| 642 |
|
} |
| 643 |
|
} |
| 644 |
|
if ($result) { |
| 645 |
|
$this->setDriveFile($path, $result); |
| 646 |
|
} |