class ValidationService (View source)

Helper elements for validating uploaded and existing files in Concrete.

\@package Helpers

Methods

bool
image($pathToImage)

Tests whether the passed item a valid image.

bool
file($pathToFile)

Tests whether a file exists.

bool
extension(string $filename, array $extensions = null)

Parses the file extension for a given file name, checks it to see if it's in the the extension array if provided if not, it checks to see if it's in the concrete.upload.extensions configuration option.

filetype($filename, $extensions = null)

No description

Details

bool image($pathToImage)

Tests whether the passed item a valid image.

Parameters

$pathToImage

Return Value

bool

bool file($pathToFile)

Tests whether a file exists.

Should probably have a list of valid file types that could be passed

Parameters

$pathToFile

Return Value

bool

bool extension(string $filename, array $extensions = null)

Parses the file extension for a given file name, checks it to see if it's in the the extension array if provided if not, it checks to see if it's in the concrete.upload.extensions configuration option.

Parameters

string $filename
array $extensions

Return Value

bool

filetype($filename, $extensions = null)

No description

Parameters

$filename
$extensions