class FileUpload

Provides access to individual files that have been uploaded by a client.

Traits

Strict class for better experience.

Constants

IMAGE_MIME_TYPES

Methods

__construct(array|null $value)

No description

string
getName()

Returns the file name.

string
getSanitizedName()

Returns the sanitized file name.

string|null
getContentType()

Returns the MIME content type of an uploaded file.

int
getSize()

Returns the size of an uploaded file.

string
getTemporaryFile()

Returns the path to an uploaded file.

string
__toString()

Returns the path to an uploaded file.

int
getError()

Returns the error code. {@link http://php.net/manual/en/features.file-upload.errors.php}

bool
isOk()

Is there any error?

bool
hasFile()

No description

move(string $dest)

Move uploaded file to new location.

bool
isImage()

Is uploaded file GIF, PNG or JPEG?

toImage()

Returns the image.

array|null
getImageSize()

Returns the dimensions of an uploaded image as array.

string|null
getContents()

Get file contents.

Details

at line 49
__construct(array|null $value)

Parameters

array|null $value

at line 67
string getName()

Returns the file name.

Return Value

string

at line 76
string getSanitizedName()

Returns the sanitized file name.

Return Value

string

at line 85
string|null getContentType()

Returns the MIME content type of an uploaded file.

Return Value

string|null

at line 97
int getSize()

Returns the size of an uploaded file.

Return Value

int

at line 106
string getTemporaryFile()

Returns the path to an uploaded file.

Return Value

string

at line 115
string __toString()

Returns the path to an uploaded file.

Return Value

string

at line 124
int getError()

Returns the error code. {@link http://php.net/manual/en/features.file-upload.errors.php}

Return Value

int

at line 133
bool isOk()

Is there any error?

Return Value

bool

at line 139
bool hasFile()

Return Value

bool

at line 149
FileUpload move(string $dest)

Move uploaded file to new location.

Parameters

string $dest

Return Value

FileUpload

at line 170
bool isImage()

Is uploaded file GIF, PNG or JPEG?

Return Value

bool

at line 180
Image toImage()

Returns the image.

Return Value

Image

Exceptions

ImageException

at line 189
array|null getImageSize()

Returns the dimensions of an uploaded image as array.

Return Value

array|null

at line 198
string|null getContents()

Get file contents.

Return Value

string|null