mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-09 11:24:35 +02: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:
@ -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(
|
||||
|
Reference in New Issue
Block a user