phasync
UploadedFile / getStream

Method

UploadedFile::getStream

Retrieve a stream representing the uploaded file.

Description#

public UploadedFile::getStream(): StreamInterface

This method MUST return a StreamInterface instance, representing the uploaded file. The purpose of this method is to allow utilizing native PHP stream functionality to manipulate the file upload, such as stream_copy_to_stream() (though the result will need to be decorated in a native PHP stream wrapper to work with such functions).

If the moveTo() method has been called previously, this method MUST raise an exception.

Return values#

Stream representation of the uploaded file. StreamInterface

Errors / Exceptions#

ExceptionWhen
RuntimeExceptionIn cases when no stream is available or can be created.