diff --git a/src/Duffer/GCSDuffer.php b/src/Duffer/GCSDuffer.php index 54e4626..1046a55 100644 --- a/src/Duffer/GCSDuffer.php +++ b/src/Duffer/GCSDuffer.php @@ -70,8 +70,12 @@ public function upload() $bucketObj = $bucket->upload($fileToUpload->getBytes(), [ 'name' => $fileName ]); + + $fileToUpload->setId($bucketObj->info()['id']); $fileToUpload->setSelfLink($bucketObj->info()['selfLink']); - //self::STORAGE_URI . $this->bucketName . '/' . ($bucketObj->name() ? $bucketObj->name() : $fileName) + $fileToUpload->setContentType($bucketObj->info()['contentType']); + $fileToUpload->setSize($bucketObj->info()['size']); + $fileToUpload->setTimeCreated($bucketObj->info()['timeCreated']); $fileToUpload->setResultPath($bucketObj->info()['mediaLink']); $fileToUpload->setStatus(File::FINISHED); } catch (\Exception $e) { diff --git a/src/Files/GCSFile.php b/src/Files/GCSFile.php index af07b05..d217861 100644 --- a/src/Files/GCSFile.php +++ b/src/Files/GCSFile.php @@ -105,7 +105,7 @@ public function getBucket() } /** - * Get files bucket name + * Set files bucket name * * @return string */ @@ -113,4 +113,64 @@ public function setBucket(string $name) { $this->bucket = $bucket; } + + /** + * Get file content-type + * + * @return string + */ + public function getContentType() + { + return $this->contentType; + } + + /** + * Set file content-type + * + * @return string + */ + public function setContentType(string $contentType) + { + $this->contentType = $contentType; + } + + /** + * Get file size + * + * @return string + */ + public function getSize() + { + return $this->size; + } + + /** + * Get file size + * + * @return string + */ + public function setSize(string $size) + { + $this->size = $size; + } + + /** + * Get file of creating on bucket + * + * @return string + */ + public function getTimeCreated() + { + return $this->timeCreated; + } + + /** + * Set file of creating on bucket + * + * @return string + */ + public function setTimeCreated(string $timeCreated) + { + $this->timeCreated = $timeCreated; + } } \ No newline at end of file