ProtectedFile::beforeSave PHP Method

beforeSave() public method

(non-PHPdoc).
See also: BaseActiveRecord::beforeSave()
public beforeSave ( )
    public function beforeSave()
    {
        if ($this->_source_path) {
            if (!file_exists(dirname($this->getPath()))) {
                mkdir(dirname($this->getPath()), 0777, true);
            }
            copy($this->_source_path, $this->getPath());
            $this->_source_path = null;
        } elseif (!file_exists($this->getPath())) {
            throw new Exception('There has been an error with file storage');
        }
        return true;
    }