In my case, I allow the user to upload an avatar image and use user_id as the file name, simply. So it will be 1.jpg, 2.jpg, etc.
However, I found that if I upload a new avatar for some account that already has one, say, user # 10 uploaded, the new file will be called "10_1.jpg". This is normal, but I do not need it, and I hope that the new file can overwrite the old one - in any case, it will also save disk space.
I searched Google and searched, but could not find clues. I was hoping there would be an option for ImageField or FileField, but it does not exist.
Thanks for the help!
source share