gump.class.php
protected function validate_extension($field, $input, $param = null)
    {
        if (!isset($input[$field])) {
            return;
        }

        if (is_array($input[$field]) && $input[$field]['error'] !== 4) {
            $param = trim(strtolower($param));
            $allowed_extensions = explode(';', $param);

            $path_info = pathinfo($input[$field]['name']);
            $extension = isset($path_info['extension']) ? $path_info['extension'] : false;

            if ($extension && in_array(strtolower($extension), $allowed_extensions)) {
                return;
            }

            return array(
                'field' => $field,
                'value' => $input[$field],
                'rule' => __FUNCTION__,
                'param' => $param,
            );
        }
    }
protected function validate_extension($field, $input, $param = null)
    {
        if (!isset($input[$field])) {
            return;
        }

        if (is_array($input[$field]) && $input[$field]['error'] !== 4) {
            $param = trim(strtolower($param));
            $allowed_extensions = explode(';', $param);

            $path_info = pathinfo($input[$field]['name']);
            $extension = isset($path_info['extension']) ? $path_info['extension'] : false;

            if ($extension && in_array(strtolower($extension), $allowed_extensions)) {
                return;
            }

            return array(
                'field' => $field,
                'value' => $input[$field],
                'rule' => __FUNCTION__,
                'param' => $param,
            );
        }
    }
protected function validate_extension ( $ field , $ input , $ param = null ) { if ( ! isset ( $ input [ $ field ] ) ) { return ; } if ( is_array ( $ input [ $ field ] ) && $ input [ $ field ] [ 'error' ] !== 4 ) { $ param = trim ( strtolower ( $ param ) ) ; $ allowed_extensions = explode ( ';' , $ param ) ; $ path_info = pathinfo ( $ input [ $ field ] [ 'name' ] ) ; $ extension = isset ( $ path_info [ 'extension' ] ) ? $ path_info [ 'extension' ] : false ; if ( $ extension && in_array ( strtolower ( $ extension ) , $ allowed_extensions ) ) { return ; } return array ( 'field' => $ field , 'value' => $ input [ $ field ] , 'rule' => __FUNCTION__ , 'param' => $ param , ) ; } }
Check the uploaded file for extension for now
checks only the ext should add mime type check.

Usage: '<index>' => 'extension,png;jpg;gif

@param string $field
@param array  $input

@return mixed
Check the uploaded file for extension for now checks only the ext should add mime type check .