diff --git a/CHANGELOG.md b/CHANGELOG.md index 63c82381b..cf2be09b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # v1.7.19 ## mm/dd/2021 +1. [](#improved) + * Added meta support for `UploadedFile` class 1. [](#bugfix) * Fixed `Warning: Undefined array key "SERVER_SOFTWARE" in index.php` [#3408](https://github.com/getgrav/grav/issues/3408) * Fixed error in `loadDirectoryConfig()` if configuration hasn't been saved [#3409](https://github.com/getgrav/grav/issues/3409) diff --git a/system/src/Grav/Framework/Psr7/UploadedFile.php b/system/src/Grav/Framework/Psr7/UploadedFile.php index f13674228..bfa63cdf4 100644 --- a/system/src/Grav/Framework/Psr7/UploadedFile.php +++ b/system/src/Grav/Framework/Psr7/UploadedFile.php @@ -23,6 +23,9 @@ class UploadedFile implements UploadedFileInterface { use UploadedFileDecoratorTrait; + /** @var array */ + private $meta = []; + /** * @param StreamInterface|string|resource $streamOrFile * @param int $size @@ -34,4 +37,34 @@ class UploadedFile implements UploadedFileInterface { $this->uploadedFile = new \Nyholm\Psr7\UploadedFile($streamOrFile, $size, $errorStatus, $clientFilename, $clientMediaType); } + + /** + * @param array $meta + * @return $this + */ + public function setMeta(array $meta) + { + $this->meta = $meta; + + return $this; + } + + /** + * @param array $meta + * @return $this + */ + public function addMeta(array $meta) + { + $this->meta = array_merge($this->meta, $meta); + + return $this; + } + + /** + * @return array + */ + public function getMeta(): array + { + return $this->meta; + } }