/**
  * Actions to be performed before the model is validated
  * @return bool
  */
 protected function beforeValidate()
 {
     if (!parent::beforeValidate()) {
         return false;
     }
     // handle the file upload
     if ($this->isNewRecord && $this->handleFileUpload) {
         $this->_file = CUploadedFile::getInstance($this, 'filename');
         $fileInfo = pathinfo($this->_file->name);
         $this->filename = $this->_file->name;
         $this->extension = $fileInfo['extension'];
         $this->filetype = $this->_file->type;
         $this->filesize = filesize($this->_file->tempName);
     }
     return true;
 }