‪TYPO3CMS  10.4
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 {
46  public function ‪createUploadedFile(
47  StreamInterface $stream,
48  int $size = null,
49  int $error = \UPLOAD_ERR_OK,
50  string $clientFilename = null,
51  string $clientMediaType = null
52  ): UploadedFileInterface {
53  if ($size === null) {
54  $size = $stream->getSize();
55  if ($size === null) {
56  throw new \InvalidArgumentException('Stream size could not be determined.', 1566823423);
57  }
58  }
59 
60  return new ‪UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType);
61  }
62 }
‪TYPO3\CMS\Core\Http\UploadedFileFactory
Definition: UploadedFileFactory.php:28
‪TYPO3\CMS\Core\Http\UploadedFileFactory\createUploadedFile
‪UploadedFileInterface createUploadedFile(StreamInterface $stream, int $size=null, int $error=\UPLOAD_ERR_OK, string $clientFilename=null, string $clientMediaType=null)
Definition: UploadedFileFactory.php:46
‪TYPO3\CMS\Core\Http\UploadedFile
Definition: UploadedFile.php:31
‪TYPO3\CMS\Core\Http
Definition: AbstractApplication.php:18