Hello everyone, i have one question.
So, I've made avatar upload in my website and there is one problem.
My code is:
$path = "images/avatars/".$HTTP_POST_FILES['image']['name'];
rename($HTTP_POST_FILES['image']['tmp_name'], $path);
$query = mysql_query("UPDATE user SET imageloc='$path' WHERE username='$username'");
As you can see my image (avatar) is copied to: images/avatars/.
Now, when I'm changing my image (avatar) it's copying new image (avatar) to: image/avatar/.
but lieving the old one too... And it's just takes a lot of takes a lot of after a lot of images(avatars).
Is there are way to delete old image(avatar) when changing it to the new one?
Thank you.