FileRules
in package
File validation rules
Tags
Table of Contents
Properties
- $request : IncomingRequest
- Request instance. So we can get access to the files.
Methods
- __construct() : mixed
- Constructor.
- ext_in() : bool
- Checks to see if an uploaded file's extension matches one in the parameter.
- is_image() : bool
- Uses the mime config file to determine if a file is considered an "image", which for our purposes basically means that it's a raster image or svg.
- max_dims() : bool
- Checks an uploaded file to verify that the dimensions are within a specified allowable dimension.
- max_size() : bool
- Verifies if the file's size in Kilobytes is no larger than the parameter.
- mime_in() : bool
- Checks to see if an uploaded file's mime type matches one in the parameter.
- uploaded() : bool
- Verifies that $name is the name of a valid uploaded file.
Properties
$request
Request instance. So we can get access to the files.
protected
IncomingRequest
$request
Methods
__construct()
Constructor.
public
__construct([RequestInterface|null $request = null ]) : mixed
Parameters
- $request : RequestInterface|null = null
ext_in()
Checks to see if an uploaded file's extension matches one in the parameter.
public
ext_in(string|null $blank, string $params) : bool
Parameters
- $blank : string|null
- $params : string
Return values
boolis_image()
Uses the mime config file to determine if a file is considered an "image", which for our purposes basically means that it's a raster image or svg.
public
is_image(string|null $blank, string $params) : bool
Parameters
- $blank : string|null
- $params : string
Return values
boolmax_dims()
Checks an uploaded file to verify that the dimensions are within a specified allowable dimension.
public
max_dims(string|null $blank, string $params) : bool
Parameters
- $blank : string|null
- $params : string
Return values
boolmax_size()
Verifies if the file's size in Kilobytes is no larger than the parameter.
public
max_size(string|null $blank, string $params) : bool
Parameters
- $blank : string|null
- $params : string
Return values
boolmime_in()
Checks to see if an uploaded file's mime type matches one in the parameter.
public
mime_in(string|null $blank, string $params) : bool
Parameters
- $blank : string|null
- $params : string
Return values
booluploaded()
Verifies that $name is the name of a valid uploaded file.
public
uploaded(string|null $blank, string $name) : bool
Parameters
- $blank : string|null
- $name : string