From ed2165342f86f74907bca7759f3909a841b430d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Thu, 8 Feb 2018 19:41:27 +0100 Subject: [PATCH] [ticket/15286] Remove thumbnail if there is an error PHPBB3-15286 --- phpBB/phpbb/attachment/upload.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phpBB/phpbb/attachment/upload.php b/phpBB/phpbb/attachment/upload.php index 8d5d5b1a12..82a7578380 100644 --- a/phpBB/phpbb/attachment/upload.php +++ b/phpBB/phpbb/attachment/upload.php @@ -206,6 +206,14 @@ class upload if (count($this->file->error)) { $this->file->remove($this->storage); + + // Remove thumbnail if exists + $thumbnail_file = 'thumb_' . $this->file->get('realname'); + if ($this->storage->exists($thumbnail_file)) + { + $this->storage->delete($thumbnail_file); + } + $this->file_data['error'] = array_merge($this->file_data['error'], $this->file->error); $this->file_data['post_attach'] = false;