# Class HttpSoft\Message\UploadedFileFactory

Factory for creating HttpSoft\Message\UploadedFile, implements Psr\Http\Message\UploadedFileFactoryInterface.

Source code on GitHub.

use HttpSoft\Message\Stream;
use HttpSoft\Message\UploadedFileFactory;

$factory = new UploadedFileFactory();
$stream = new Stream('/tmp/phpN3FmFr', 'wb+');
$uploadedFile = $factory->createUploadedFile($stream, 1024, UPLOAD_ERR_OK, 'file.txt', 'text/plain');

$uploadedFile->getClientFilename(); // 'file.txt'
$uploadedFile->getClientMediaType(); // 'text/plain'
$uploadedFile->getStream()->getMetadata('uri'); // '/tmp/phpN3FmFr'
$uploadedFile->getError(); // 0
$uploadedFile->getSize(); // 1024

# Public methods

See the original detailed description of the methods in the Psr\Http\Message\UploadedFileFactoryInterface.

# createUploadedFile

Create a new HttpSoft\Message\UploadedFile instance.

/**
 * @param StreamInterface $stream
 * @param int|null $size
 * @param int $error
 * @param string|null $clientFilename
 * @param string|null $clientMediaType
 * @return UploadedFileInterface
 */
public function createUploadedFile(
    StreamInterface $stream,
    int $size = null,
    int $error = UPLOAD_ERR_OK,
    string $clientFilename = null,
    string $clientMediaType = null
): UploadedFileInterface;