class UploadedFileFactory (View source)

Has the ability to create streams for uploaded files.

Methods

UploadedFileInterface
createUploadedFile(StreamInterface $stream, int $size = null, int $error = \UPLOAD_ERR_OK, string $clientFilename = null, string $clientMediaType = null)

Create a new uploaded file.

Details

UploadedFileInterface createUploadedFile(StreamInterface $stream, int $size = null, int $error = \UPLOAD_ERR_OK, string $clientFilename = null, string $clientMediaType = null)

Create a new uploaded file.

If a size is not provided it will be determined by checking the size of the stream.

Parameters

StreamInterface $stream The underlying stream representing the uploaded file content.
int $size The size of the file in bytes.
int $error The PHP file upload error.
string $clientFilename The filename as provided by the client, if any.
string $clientMediaType The media type as provided by the client, if any.

Return Value

UploadedFileInterface

Exceptions

InvalidArgumentException If the file resource is not readable.