diff --git a/src/UploadedFile.php b/src/UploadedFile.php index 5c3f438..0ddfed3 100644 --- a/src/UploadedFile.php +++ b/src/UploadedFile.php @@ -208,6 +208,18 @@ public function getSize(): ?int { return $this->size; } + + /** + * Returns the client-provided full path to the file + * + * @internal This method is not part of the PSR-7 standard + * + * @return string + */ + public function getFilePath(): string + { + return $this->file; + } /** * Create a normalized tree of UploadedFile instances from the Environment. diff --git a/tests/UploadedFileTest.php b/tests/UploadedFileTest.php index 82d3471..adeefaa 100644 --- a/tests/UploadedFileTest.php +++ b/tests/UploadedFileTest.php @@ -153,6 +153,7 @@ public function testConstructor() $this->assertEquals($attr['type'], $uploadedFile->getClientMediaType()); $this->assertEquals($attr['size'], $uploadedFile->getSize()); $this->assertEquals($attr['error'], $uploadedFile->getError()); + $this->assertEquals($attr['tmp_name'], $uploadedFile->getFilePath()); return $uploadedFile; } @@ -183,6 +184,7 @@ public function testConstructorSapi() $this->assertEquals($attr['type'], $uploadedFile->getClientMediaType()); $this->assertEquals($attr['size'], $uploadedFile->getSize()); $this->assertEquals($attr['error'], $uploadedFile->getError()); + $this->assertEquals($attr['tmp_name'], $uploadedFile->getFilePath()); return $uploadedFile; } @@ -409,6 +411,7 @@ private function runFileUploadWithTempStreamTest(callable $streamFactory, callab $this->assertSame($error, $file->getError()); $this->assertSame($clientFilename, $file->getClientFilename()); $this->assertSame($clientMediaType, $file->getClientMediaType()); + $this->assertSame($stream->getMetadata('uri'), $file->getFilePath()); } /**