1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 12:03:21 +01:00

[ticket/13980] Uploaded avatar not removed when new is uploaded

Remove the previously uploaded avatar when a new one with a different
extension is uploaded, using existing delete method

PHPBB3-13980
This commit is contained in:
javiexin 2015-07-09 15:31:28 +02:00
parent 352e995674
commit d0cdc5553a

View File

@ -161,14 +161,11 @@ class upload extends \phpbb\avatar\driver\driver
return false;
}
// Delete current avatar if not overwritten
$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);
}
$this->delete($row);
}
return array(