public function beforeValidate()
    {
        if ($this->owner->{$this->attribute} instanceof UploadedFile) {
            $this->file = $this->owner->{$this->attribute};
            return;
        }

        $this->file = UploadedFile::getInstance($this->owner, $this->attribute);

        if (empty($this->file)) {
            $this->file = UploadedFile::getInstanceByName($this->attribute);
        }

        if ($this->file instanceof UploadedFile) {
            $this->owner->{$this->attribute} = $this->file;
        }
    }
public function beforeValidate()
    {
        if ($this->owner->{$this->attribute} instanceof UploadedFile) {
            $this->file = $this->owner->{$this->attribute};
            return;
        }

        $this->file = UploadedFile::getInstance($this->owner, $this->attribute);

        if (empty($this->file)) {
            $this->file = UploadedFile::getInstanceByName($this->attribute);
        }

        if ($this->file instanceof UploadedFile) {
            $this->owner->{$this->attribute} = $this->file;
        }
    }
public function beforeValidate ( ) { if ( $ this -> owner -> { $ this -> attribute } instanceof UploadedFile ) { $ this -> file = $ this -> owner -> { $ this -> attribute } ; return ; } $ this -> file = UploadedFile :: getInstance ( $ this -> owner , $ this -> attribute ) ; if ( empty ( $ this -> file ) ) { $ this -> file = UploadedFile :: getInstanceByName ( $ this -> attribute ) ; } if ( $ this -> file instanceof UploadedFile ) { $ this -> owner -> { $ this -> attribute } = $ this -> file ; } }
Before validate event.
Before validate event .