public function validate(ValidationResult $result, $filename = null)
    {
        if (empty($filename)) {
            $filename = $this->getFilename();
        }
        if (empty($filename) || $this->isValidFilename($filename)) {
            return true;
        }

        $message = _t(
            'SilverStripe\\Assets\\File.INVALIDEXTENSION_SHORT_EXT',
            'Extension \'{extension}\' is not allowed',
            [ 'extension' => strtolower(File::get_file_extension($filename)) ]
        );
        $result->addError($message);
        return false;
    }
public function validate(ValidationResult $result, $filename = null)
    {
        if (empty($filename)) {
            $filename = $this->getFilename();
        }
        if (empty($filename) || $this->isValidFilename($filename)) {
            return true;
        }

        $message = _t(
            'SilverStripe\\Assets\\File.INVALIDEXTENSION_SHORT_EXT',
            'Extension \'{extension}\' is not allowed',
            [ 'extension' => strtolower(File::get_file_extension($filename)) ]
        );
        $result->addError($message);
        return false;
    }
public function validate ( ValidationResult $ result , $ filename = null ) { if ( empty ( $ filename ) ) { $ filename = $ this -> getFilename ( ) ; } if ( empty ( $ filename ) || $ this -> isValidFilename ( $ filename ) ) { return true ; } $ message = _t ( 'SilverStripe\\Assets\\File.INVALIDEXTENSION_SHORT_EXT' , 'Extension \'{extension}\' is not allowed' , [ 'extension' => strtolower ( File :: get_file_extension ( $ filename ) ) ] ) ; $ result -> addError ( $ message ) ; return false ; }
Hook to validate this record against a validation result

@param ValidationResult $result
@param string $filename Optional filename to validate. If omitted, the current value is validated.
@return bool Valid flag
Hook to validate this record against a validation result