Gregwar\Formidable\Fields\FileField::check PHP Метод

check() публичный Метод

public check ( )
    public function check()
    {
        if ($this->hasData()) {
            if (null !== $this->maxsize && $this->datas['size'] > $this->maxsize) {
                return array('file_size_too_big', $this->printName(), $this->sizePrettyize($this->maxsize));
            }
            if (null !== $this->filetype) {
                switch ($this->filetype) {
                    case 'image':
                        $size = @getimagesize($this->datas['tmp_name']);
                        if (!$size || !$size[0] || !$size[1]) {
                            return array('file_image', $this->printName());
                        }
                    default:
                        break;
                }
            }
        } else {
            if ($this->required) {
                return array('file_required', $this->printName());
            }
        }
        return;
    }