public function UploadedFile::__construct in Zircon Profile 8
Same name in this branch
- 8 vendor/zendframework/zend-diactoros/src/UploadedFile.php \Zend\Diactoros\UploadedFile::__construct()
- 8 vendor/symfony/http-foundation/File/UploadedFile.php \Symfony\Component\HttpFoundation\File\UploadedFile::__construct()
- 8 vendor/symfony/psr-http-message-bridge/Tests/Fixtures/UploadedFile.php \Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\UploadedFile::__construct()
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-diactoros/src/UploadedFile.php \Zend\Diactoros\UploadedFile::__construct()
File
- vendor/
zendframework/ zend-diactoros/ src/ UploadedFile.php, line 54
Class
Namespace
Zend\DiactorosCode
public function __construct($streamOrFile, $size, $errorStatus, $clientFilename = null, $clientMediaType = null) {
if ($errorStatus === UPLOAD_ERR_OK) {
if (is_string($streamOrFile)) {
$this->file = $streamOrFile;
}
if (is_resource($streamOrFile)) {
$this->stream = new Stream($streamOrFile);
}
if (!$this->file && !$this->stream) {
if (!$streamOrFile instanceof StreamInterface) {
throw new InvalidArgumentException('Invalid stream or file provided for UploadedFile');
}
$this->stream = $streamOrFile;
}
}
if (!is_int($size)) {
throw new InvalidArgumentException('Invalid size provided for UploadedFile; must be an int');
}
$this->size = $size;
if (!is_int($errorStatus) || 0 > $errorStatus || 8 < $errorStatus) {
throw new InvalidArgumentException('Invalid error status for UploadedFile; must be an UPLOAD_ERR_* constant');
}
$this->error = $errorStatus;
if (null !== $clientFilename && !is_string($clientFilename)) {
throw new InvalidArgumentException('Invalid client filename provided for UploadedFile; must be null or a string');
}
$this->clientFilename = $clientFilename;
if (null !== $clientMediaType && !is_string($clientMediaType)) {
throw new InvalidArgumentException('Invalid client media type provided for UploadedFile; must be null or a string');
}
$this->clientMediaType = $clientMediaType;
}