Swat/SwatFileEntry.php
public function process()
    {
        parent::process();

        // The $_FILES[$this->id] array is always set unless the POST data
        // was greater than the PHP's post_max_size ini setting.
        if (!isset($_FILES[$this->id]) || !$this->isSensitive()) {
            return;
        }

        if ($_FILES[$this->id]['error'] === UPLOAD_ERR_OK) {
            $this->file = $_FILES[$this->id];

            if (!$this->hasValidMimeType()) {
                $this->addMessage($this->getValidationMessage('mime-type'));
            }
        } elseif ($_FILES[$this->id]['error'] === UPLOAD_ERR_NO_FILE) {
            if ($this->required) {
                $this->addMessage($this->getValidationMessage('required'));
            }
        } elseif (
            $_FILES[$this->id]['error'] === UPLOAD_ERR_INI_SIZE ||
            $_FILES[$this->id]['error'] === UPLOAD_ERR_FORM_SIZE
        ) {
            $this->addMessage($this->getValidationMessage('too-large'));
        } else {
            // There are other status codes we may want to check for in the
            // future. Upload status codes can be found here:
            // http://php.net/manual/en/features.file-upload.errors.php
            $this->addMessage($this->getValidationMessage('upload-error'));
        }
    }
public function process()
    {
        parent::process();

        // The $_FILES[$this->id] array is always set unless the POST data
        // was greater than the PHP's post_max_size ini setting.
        if (!isset($_FILES[$this->id]) || !$this->isSensitive()) {
            return;
        }

        if ($_FILES[$this->id]['error'] === UPLOAD_ERR_OK) {
            $this->file = $_FILES[$this->id];

            if (!$this->hasValidMimeType()) {
                $this->addMessage($this->getValidationMessage('mime-type'));
            }
        } elseif ($_FILES[$this->id]['error'] === UPLOAD_ERR_NO_FILE) {
            if ($this->required) {
                $this->addMessage($this->getValidationMessage('required'));
            }
        } elseif (
            $_FILES[$this->id]['error'] === UPLOAD_ERR_INI_SIZE ||
            $_FILES[$this->id]['error'] === UPLOAD_ERR_FORM_SIZE
        ) {
            $this->addMessage($this->getValidationMessage('too-large'));
        } else {
            // There are other status codes we may want to check for in the
            // future. Upload status codes can be found here:
            // http://php.net/manual/en/features.file-upload.errors.php
            $this->addMessage($this->getValidationMessage('upload-error'));
        }
    }
public function process ( ) { parent :: process ( ) ; // The $_FILES[$this->id] array is always set unless the POST data // was greater than the PHP's post_max_size ini setting. if ( ! isset ( $ _FILES [ $ this -> id ] ) || ! $ this -> isSensitive ( ) ) { return ; } if ( $ _FILES [ $ this -> id ] [ 'error' ] === UPLOAD_ERR_OK ) { $ this -> file = $ _FILES [ $ this -> id ] ; if ( ! $ this -> hasValidMimeType ( ) ) { $ this -> addMessage ( $ this -> getValidationMessage ( 'mime-type' ) ) ; } } elseif ( $ _FILES [ $ this -> id ] [ 'error' ] === UPLOAD_ERR_NO_FILE ) { if ( $ this -> required ) { $ this -> addMessage ( $ this -> getValidationMessage ( 'required' ) ) ; } } elseif ( $ _FILES [ $ this -> id ] [ 'error' ] === UPLOAD_ERR_INI_SIZE || $ _FILES [ $ this -> id ] [ 'error' ] === UPLOAD_ERR_FORM_SIZE ) { $ this -> addMessage ( $ this -> getValidationMessage ( 'too-large' ) ) ; } else { // There are other status codes we may want to check for in the // future. Upload status codes can be found here: // http://php.net/manual/en/features.file-upload.errors.php $ this -> addMessage ( $ this -> getValidationMessage ( 'upload-error' ) ) ; } }
Processes this file entry widget

If any validation type errors occur, an error message is attached to
this entry widget.
Processes this file entry widget