Fix remove avatar if previous version isn't exists
This commit is contained in:
parent
2238fc39af
commit
0b7be053a4
|
@ -93,7 +93,7 @@ class Dashboard extends BaseController
|
|||
$userData = $this->usersModel->getUser($this->session->username);
|
||||
$avatar = FCPATH . '/img/users/'. $userData->img;
|
||||
$oldAvatarFile = new \CodeIgniter\Files\File($avatar);
|
||||
if ($oldAvatarFile->getExtension() != $ext) unlink($avatar);
|
||||
if ($oldAvatarFile->getExtension() != $ext && file_exists($avatar)) unlink($avatar);
|
||||
|
||||
$filename = "{$this->session->username}.$ext";
|
||||
$move = $file->move(FCPATH . '/img/users/', $filename, true);
|
||||
|
|
Loading…
Reference in New Issue