Properties

$errors

$errors : int[]

Type

int[]

$clientFilename

$clientFilename : string

Type

string

$clientMediaType

$clientMediaType : string

Type

string

$error

$error : int

Type

int

$moved

$moved : bool

Type

bool

$size

$size : int

Type

int

Methods

__construct()

__construct(\Psr\Http\Message\StreamInterface|string|resource  $streamOrFile, int  $size, int  $errorStatus, string|null  $clientFilename = null, string|null  $clientMediaType = null) : mixed

Parameters

\Psr\Http\Message\StreamInterface|string|resource $streamOrFile
int $size
int $errorStatus
string|null $clientFilename
string|null $clientMediaType

Returns

mixed —

isMoved()

isMoved() : bool

Returns

bool —

getStream()

getStream() : \Psr\Http\Message\StreamInterface

Retrieve a stream representing the uploaded file.

Throws

\RuntimeException

if the upload was not successful.

Returns

\Psr\Http\Message\StreamInterface —

Stream representation of the uploaded file.

moveTo()

moveTo(string  $targetPath) : mixed

Move the uploaded file to a new location.

Parameters

string $targetPath

Path to which to move the uploaded file.

Throws

\RuntimeException

if the upload was not successful.

\InvalidArgumentException

if the $path specified is invalid.

\RuntimeException

on any error during the move operation, or on the second or subsequent call to the method.

Returns

mixed —

getSize()

getSize() : int|null

Retrieve the file size.

Returns

int|null —

The file size in bytes or null if unknown.

getError()

getError() : int

Retrieve the error associated with the uploaded file.

Returns

int —

One of PHP's UPLOAD_ERR_XXX constants.

getClientFilename()

getClientFilename() : string|null

Retrieve the filename sent by the client.

Returns

string|null —

The filename sent by the client or null if none was provided.

getClientMediaType()

getClientMediaType() : string|null

Retrieve the media type sent by the client.

Returns

string|null —

The media type sent by the client or null if none was provided.

setStreamOrFile()

setStreamOrFile(mixed  $streamOrFile) : mixed

Depending on the value set file or stream variable

Parameters

mixed $streamOrFile

Throws

\InvalidArgumentException

Returns

mixed —

setError()

setError(int  $error) : mixed

Parameters

int $error

Throws

\InvalidArgumentException

Returns

mixed —

setSize()

setSize(int  $size) : mixed

Parameters

int $size

Throws

\InvalidArgumentException

Returns

mixed —

isStringOrNull()

isStringOrNull(mixed  $param) : bool

Parameters

mixed $param

Returns

bool —

isStringNotEmpty()

isStringNotEmpty(mixed  $param) : bool

Parameters

mixed $param

Returns

bool —

setClientFilename()

setClientFilename(string|null  $clientFilename) : mixed

Parameters

string|null $clientFilename

Throws

\InvalidArgumentException

Returns

mixed —

setClientMediaType()

setClientMediaType(string|null  $clientMediaType) : mixed

Parameters

string|null $clientMediaType

Throws

\InvalidArgumentException

Returns

mixed —

isOk()

isOk() : bool

Return true if there is no upload error

Returns

bool —

validateActive()

validateActive() : mixed

Throws

\RuntimeException

if is moved or not ok

Returns

mixed —