From 5ff3d26f8ddc3a85d20bd626989ba62be963c289 Mon Sep 17 00:00:00 2001 From: Anastasia Date: Thu, 30 Aug 2018 17:23:13 +0300 Subject: [PATCH] images path --- common/models/Customer.php | 8 ++++---- frontend/controllers/SiteController.php | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common/models/Customer.php b/common/models/Customer.php index 0954ddc..a784f63 100644 --- a/common/models/Customer.php +++ b/common/models/Customer.php @@ -155,10 +155,10 @@ if (!file_exists(\Yii::getAlias('@storage/customers/'))) { FileHelper::createDirectory(\Yii::getAlias('@storage/customers/')); } - - if ($file->saveAs(\Yii::getAlias('@storage/customers/') . $file->baseName.'_'.Yii::$app->security->generateRandomString(5).'.'.$file->extension)) { - $this->image = '/storage/customers/'.$file->baseName.'_'.Yii::$app->security->generateRandomString(5).'.'.$file->extension; - $this->file->name = $file->baseName.'_'.Yii::$app->security->generateRandomString(5).'.'.$file->extension;; + $filename = $file->baseName.'_'.Yii::$app->security->generateRandomString(5).'.'.$file->extension; + if ($file->saveAs(\Yii::getAlias('@storage/customers/') . $filename)) { + $this->image = '/storage/customers/'.$filename; + $this->file->name = $filename; return true; } return false; diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index abcc9a9..d6b5c9c 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -161,6 +161,7 @@ return $this->redirect(['site/index']); } } + return $this->render('signup', [ 'model' => $model ]); -- libgit2 0.21.4