public function actionLinet2Import() { $model = new FormLinet2Import(); if (isset($_POST['FormLinet2Import'])) { $configPath = Yii::app()->user->settings["company.path"]; $file = Company::getFilePath() . "linet2.bak"; $model->file = $_POST['FormLinet2Import']['file']; $model->file = CUploadedFile::getInstance($model, 'file'); if ($model->file === null) { throw new CHttpException(501, Yii::t('app', 'Error in request.')); } //no file if ($model->file->saveAs($file)) { $model->file = $file; $model->import(); //$model->read(); } } $this->render('linet2Import', array('model' => $model)); Yii::app()->end(); }
public static function getCertFilePath($id = null) { if ($id == null) { $id = Yii::app()->user->id; } $user = User::model()->findByPk($id); if ($user !== null) { return Company::getFilePath() . "cert/" . $id . ".p12"; } }
function import($account) { $file = CUploadedFile::getInstance($this, 'file'); //echo 'not file'; if (is_object($file) && get_class($file) === 'CUploadedFile') { //echo 'is file'; $filename = Company::getFilePath() . "TNout"; //x if ($file->saveAs($filename)) { //read file... $fp = fopen($filename, 'r'); return $this->readFile($fp, $account); } else { throw new CHttpException(500, Yii('app', 'cannot save bankbook')); } } }
public function getFullPath() { return Company::getFilePath() . $this->path; }