‪TYPO3CMS  ‪main
UploadedFileFactory.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 namespace ‪TYPO3\CMS\Core\Http;
19 
20 use Psr\Http\Message\StreamInterface;
21 use Psr\Http\Message\UploadedFileFactoryInterface;
22 use Psr\Http\Message\UploadedFileInterface;
23 
27 class ‪UploadedFileFactory implements UploadedFileFactoryInterface
28 {
45  public function ‪createUploadedFile(
46  StreamInterface $stream,
47  int $size = null,
48  int $error = \UPLOAD_ERR_OK,
49  string $clientFilename = null,
50  string $clientMediaType = null
51  ): UploadedFileInterface {
52  if ($size === null) {
53  $size = $stream->getSize();
54  if ($size === null) {
55  throw new \InvalidArgumentException('Stream size could not be determined.', 1566823423);
56  }
57  }
58 
59  return new ‪UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType);
60  }
61 }
‪TYPO3\CMS\Core\Http\UploadedFileFactory\createUploadedFile
‪createUploadedFile(StreamInterface $stream, int $size=null, int $error=\UPLOAD_ERR_OK, string $clientFilename=null, string $clientMediaType=null)
Definition: UploadedFileFactory.php:45
‪TYPO3\CMS\Core\Http\UploadedFileFactory
Definition: UploadedFileFactory.php:28
‪TYPO3\CMS\Core\Http\UploadedFile
Definition: UploadedFile.php:34
‪TYPO3\CMS\Core\Http
Definition: AbstractApplication.php:18