UploadedFile::getStream()

In this article

Source

public function getStream(): StreamInterface
{
    $this->validateActive();
    if ($this->stream instanceof StreamInterface) {
        return $this->stream;
    }
    if (\false === $resource = @\fopen($this->file, 'r')) {
        throw new \RuntimeException(\sprintf('The file "%s" cannot be opened: %s', $this->file, \error_get_last()['message'] ?? ''));
    }
    return Stream::create($resource);
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.