You are here

public function UploadedFile::getStream in Zircon Profile 8

Same name in this branch
  1. 8 vendor/zendframework/zend-diactoros/src/UploadedFile.php \Zend\Diactoros\UploadedFile::getStream()
  2. 8 vendor/symfony/psr-http-message-bridge/Tests/Fixtures/UploadedFile.php \Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\UploadedFile::getStream()
Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/UploadedFile.php \Zend\Diactoros\UploadedFile::getStream()

Throws

\RuntimeException if the upload was not successful.

Overrides UploadedFileInterface::getStream

1 call to UploadedFile::getStream()
UploadedFile::writeFile in vendor/zendframework/zend-diactoros/src/UploadedFile.php
Write internal stream to given path

File

vendor/zendframework/zend-diactoros/src/UploadedFile.php, line 106

Class

UploadedFile

Namespace

Zend\Diactoros

Code

public function getStream() {
  if ($this->error !== UPLOAD_ERR_OK) {
    throw new RuntimeException('Cannot retrieve stream due to upload error');
  }
  if ($this->moved) {
    throw new RuntimeException('Cannot retrieve stream after it has already been moved');
  }
  if ($this->stream instanceof StreamInterface) {
    return $this->stream;
  }
  $this->stream = new Stream($this->file);
  return $this->stream;
}