From a5e4ca259aa98bc3d5abc03dcf4504c2afe91e92 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 8 Sep 2009 14:02:40 +0000 Subject: [PATCH] Always remove temporary filename (Bug #50965) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10122 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_upload.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index 40ff4de2d1..a7abb06674 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -313,12 +313,9 @@ class filespec if (!@move_uploaded_file($this->filename, $this->destination_file)) { $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); - return false; } } - @unlink($this->filename); - break; case 'move': @@ -328,12 +325,9 @@ class filespec if (!@copy($this->filename, $this->destination_file)) { $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); - return false; } } - @unlink($this->filename); - break; case 'local': @@ -341,14 +335,21 @@ class filespec if (!@copy($this->filename, $this->destination_file)) { $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); - return false; } - @unlink($this->filename); break; } + // Remove temporary filename + @unlink($this->filename); + + if (sizeof($this->error)) + { + return false; + } + phpbb_chmod($this->destination_file, $chmod); + return true; } // Try to get real filesize from destination folder