Commit 5ff3d26f8ddc3a85d20bd626989ba62be963c289
1 parent
fb24e167
images path
Showing
2 changed files
with
5 additions
and
4 deletions
Show diff stats
common/models/Customer.php
| @@ -155,10 +155,10 @@ | @@ -155,10 +155,10 @@ | ||
| 155 | if (!file_exists(\Yii::getAlias('@storage/customers/'))) { | 155 | if (!file_exists(\Yii::getAlias('@storage/customers/'))) { |
| 156 | FileHelper::createDirectory(\Yii::getAlias('@storage/customers/')); | 156 | FileHelper::createDirectory(\Yii::getAlias('@storage/customers/')); |
| 157 | } | 157 | } |
| 158 | - | ||
| 159 | - if ($file->saveAs(\Yii::getAlias('@storage/customers/') . $file->baseName.'_'.Yii::$app->security->generateRandomString(5).'.'.$file->extension)) { | ||
| 160 | - $this->image = '/storage/customers/'.$file->baseName.'_'.Yii::$app->security->generateRandomString(5).'.'.$file->extension; | ||
| 161 | - $this->file->name = $file->baseName.'_'.Yii::$app->security->generateRandomString(5).'.'.$file->extension;; | 158 | + $filename = $file->baseName.'_'.Yii::$app->security->generateRandomString(5).'.'.$file->extension; |
| 159 | + if ($file->saveAs(\Yii::getAlias('@storage/customers/') . $filename)) { | ||
| 160 | + $this->image = '/storage/customers/'.$filename; | ||
| 161 | + $this->file->name = $filename; | ||
| 162 | return true; | 162 | return true; |
| 163 | } | 163 | } |
| 164 | return false; | 164 | return false; |
frontend/controllers/SiteController.php