Aplus Framework Docs

FilesValidator
in package

Class FilesValidator.

Table of Contents

$files  : array<string|int, mixed>
dim()  : bool
Validates image dimensions.
ext()  : bool
Validates file accepted extensions.
image()  : bool
Validates file is an image.
maxDim()  : bool
Validates image max dimensions.
maxSize()  : bool
Validates file size.
mimes()  : bool
Validates file accepted MIME types.
minDim()  : bool
Validates image min dimensions.
uploaded()  : bool
Validates file is uploaded.
getFile()  : array<string, mixed>|null
getOrganizedFiles()  : array<string, mixed>
Get $_FILES in a re-organized way.

Properties

Methods

dim()

Validates image dimensions.

public static dim(string $field, array<string, mixed> $data, int $width, int $height) : bool
Parameters
$field : string
$data : array<string, mixed>
$width : int
$height : int
Return values
bool

ext()

Validates file accepted extensions.

public static ext(string $field, array<string, mixed> $data, string ...$allowedExtensions) : bool

NOTE: For greater security use the FilesValidator::mimes() method to filter the file type.

Parameters
$field : string
$data : array<string, mixed>
$allowedExtensions : string
Return values
bool

image()

Validates file is an image.

public static image(string $field[, array<string, mixed> $data = [] ]) : bool
Parameters
$field : string
$data : array<string, mixed> = []
Return values
bool

maxDim()

Validates image max dimensions.

public static maxDim(string $field, array<string, mixed> $data, int $width, int $height) : bool
Parameters
$field : string
$data : array<string, mixed>
$width : int
$height : int
Return values
bool

maxSize()

Validates file size.

public static maxSize(string $field, array<string, mixed> $data, int $kilobytes) : bool
Parameters
$field : string
$data : array<string, mixed>
$kilobytes : int
Return values
bool

mimes()

Validates file accepted MIME types.

public static mimes(string $field, array<string, mixed> $data, string ...$allowedTypes) : bool
Parameters
$field : string
$data : array<string, mixed>
$allowedTypes : string
Return values
bool

minDim()

Validates image min dimensions.

public static minDim(string $field, array<string, mixed> $data, int $width, int $height) : bool
Parameters
$field : string
$data : array<string, mixed>
$width : int
$height : int
Return values
bool

uploaded()

Validates file is uploaded.

public static uploaded(string $field[, array<string, mixed> $data = [] ]) : bool
Parameters
$field : string
$data : array<string, mixed> = []
Return values
bool

getFile()

protected static getFile(string $field) : array<string, mixed>|null
Parameters
$field : string
Return values
array<string, mixed>|null

getOrganizedFiles()

Get $_FILES in a re-organized way.

protected static getOrganizedFiles() : array<string, mixed>
Return values
array<string, mixed>

Search results