aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/avatar/driver/upload.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/avatar/driver/upload.php')
-rw-r--r--phpBB/phpbb/avatar/driver/upload.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php
index ee36243844..eae96cd794 100644
--- a/phpBB/phpbb/avatar/driver/upload.php
+++ b/phpBB/phpbb/avatar/driver/upload.php
@@ -161,6 +161,16 @@ class upload extends \phpbb\avatar\driver\driver
return false;
}
+ $ext = substr(strrchr($row['avatar'], '.'), 1);
+ if ($ext && $ext !== $file->get('extension'))
+ {
+ $filename = $this->phpbb_root_path . $this->config['avatar_path'] . '/' . $this->config['avatar_salt'] . '_' . $row['id'] . '.' . $ext;
+ if (file_exists($filename))
+ {
+ @unlink($filename);
+ }
+ }
+
return array(
'avatar' => $row['id'] . '_' . time() . '.' . $file->get('extension'),
'avatar_width' => $file->get('width'),