I'm writing a web application where users can upload images. I wonder what's the best practice of assigning unique names to images ? I thought MD5 can ben useful and enough, but since each image has an owner, do I have to use MD5 ? I mean it could be enough to rename with Userid + imagename + creationdate ?
Your database gives you a unique ID for each record. Though there are many different ways to do what you want, it is usually best to use this ID as a prefix/suffix to the name of the image. So, for these records:
ID | name
15 image.png
23 image.png
you could display something like: 15_image.png
, 23_image.png