From 91da5d1cc0f339f94922e48bdcce1bace602713a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 9 Jul 2015 15:14:35 +0300 Subject: Fix #3965 --- system/libraries/Upload.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'system') diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index a1bd14930..51232f8a7 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -533,15 +533,9 @@ class CI_Upload { * If it returns false there was a problem. */ $this->orig_name = $this->file_name; - - if ($this->overwrite === FALSE) + if (FALSE === ($this->file_name = $this->set_filename($this->upload_path, $this->file_name))) { - $this->file_name = $this->set_filename($this->upload_path, $this->file_name); - - if ($this->file_name === FALSE) - { - return FALSE; - } + return FALSE; } /* @@ -656,7 +650,7 @@ class CI_Upload { $filename = md5(uniqid(mt_rand())).$this->file_ext; } - if ( ! file_exists($path.$filename)) + if ($this->overwrite === TRUE OR ! file_exists($path.$filename)) { return $filename; } -- cgit v1.2.3-24-g4f1b