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