UploadedFile
in package
implements
UploadedFileInterface
Interfaces, Classes and Traits
- UploadedFileInterface
- Value object representing a file uploaded through an HTTP request.
Table of Contents
- $clientFilename : string
- $clientMediaType : string
- $error : int
- $errors : array<string|int, int>
- $file : string|null
- $moved : bool
- $size : int
- $stream : StreamInterface|null
- __construct() : mixed
- getClientFilename() : string|null
- Retrieve the filename sent by the client.
- getClientMediaType() : string|null
- Retrieve the media type sent by the client.
- getError() : int
- Retrieve the error associated with the uploaded file.
- getSize() : int|null
- Retrieve the file size.
- getStream() : StreamInterface
- Retrieve a stream representing the uploaded file.
- isMoved() : bool
- moveTo() : mixed
- Move the uploaded file to a new location.
- isOk() : bool
- Return true if there is no upload error
- isStringNotEmpty() : bool
- isStringOrNull() : bool
- setClientFilename() : mixed
- setClientMediaType() : mixed
- setError() : mixed
- setSize() : mixed
- setStreamOrFile() : mixed
- Depending on the value set file or stream variable
- validateActive() : mixed
Properties
$clientFilename
private
string
$clientFilename
$clientMediaType
private
string
$clientMediaType
$error
private
int
$error
$errors
private
static array<string|int, int>
$errors
= [UPLOAD_ERR_OK, UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION]
$file
private
string|null
$file
$moved
private
bool
$moved
= false
$size
private
int
$size
$stream
private
StreamInterface|null
$stream
Methods
__construct()
public
__construct(StreamInterface|string|resource $streamOrFile, int $size, int $errorStatus[, string|null $clientFilename = null ][, string|null $clientMediaType = null ]) : mixed
Parameters
- $streamOrFile : StreamInterface|string|resource
- $size : int
- $errorStatus : int
- $clientFilename : string|null = null
- $clientMediaType : string|null = null
Return values
mixed —getClientFilename()
Retrieve the filename sent by the client.
public
getClientFilename() : string|null
Return values
string|null —The filename sent by the client or null if none was provided.
getClientMediaType()
Retrieve the media type sent by the client.
public
getClientMediaType() : string|null
Return values
string|null —The media type sent by the client or null if none was provided.
getError()
Retrieve the error associated with the uploaded file.
public
getError() : int
Tags
Return values
int —One of PHP's UPLOAD_ERR_XXX constants.
getSize()
Retrieve the file size.
public
getSize() : int|null
Return values
int|null —The file size in bytes or null if unknown.
getStream()
Retrieve a stream representing the uploaded file.
public
getStream() : StreamInterface
Tags
Return values
StreamInterface —Stream representation of the uploaded file.
isMoved()
public
isMoved() : bool
Return values
bool —moveTo()
Move the uploaded file to a new location.
public
moveTo(string $targetPath) : mixed
Parameters
- $targetPath : string
-
Path to which to move the uploaded file.
Tags
Return values
mixed —isOk()
Return true if there is no upload error
private
isOk() : bool
Return values
bool —isStringNotEmpty()
private
isStringNotEmpty(mixed $param) : bool
Parameters
- $param : mixed
Return values
bool —isStringOrNull()
private
isStringOrNull(mixed $param) : bool
Parameters
- $param : mixed
Return values
bool —setClientFilename()
private
setClientFilename(string|null $clientFilename) : mixed
Parameters
- $clientFilename : string|null
Tags
Return values
mixed —setClientMediaType()
private
setClientMediaType(string|null $clientMediaType) : mixed
Parameters
- $clientMediaType : string|null
Tags
Return values
mixed —setError()
private
setError(int $error) : mixed
Parameters
- $error : int
Tags
Return values
mixed —setSize()
private
setSize(int $size) : mixed
Parameters
- $size : int
Tags
Return values
mixed —setStreamOrFile()
Depending on the value set file or stream variable
private
setStreamOrFile(mixed $streamOrFile) : mixed
Parameters
- $streamOrFile : mixed
Tags
Return values
mixed —validateActive()
private
validateActive() : mixed