mongosoft\file\UploadBehavior::afterSave PHP Метод

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

This method is called at the end of inserting or updating a record.
public afterSave ( )
    public function afterSave()
    {
        if ($this->_file instanceof UploadedFile) {
            $path = $this->getUploadPath($this->attribute);
            if (is_string($path) && FileHelper::createDirectory(dirname($path))) {
                $this->save($this->_file, $path);
                $this->afterUpload();
            } else {
                throw new InvalidParamException("Directory specified in 'path' attribute doesn't exist or cannot be created.");
            }
        }
    }

Usage Example

 /**
  * @inheritdoc
  */
 public function afterSave()
 {
     parent::afterSave();
     if ($this->crop_changed) {
         $this->createCrop();
     }
 }
All Usage Examples Of mongosoft\file\UploadBehavior::afterSave