On the systems I used to develop before, I used to save the full path of the file in the database.
Example:
c:\xampp\htdocs\teste\imagens\post_44\stack_overflow.png
// Image table
imagem
- id = 1
- imagem = imagens/post_44/stack_overflow.png
-post_id = 44
Then, when I started using frameworks, I just put the name of the file with the extension in the registry (and the other data I get according to the query in the database).
image
- id = 1
- image = stack_overflow.png
- post_id = 44
In this case, I do this because I develop with the Framework in PHP, and it makes it easier for me to "mount" the path of that image.
But when it comes to other cases, such as in "hand-held" systems, which is the best way to store a file name in the database (also considering performance and maintenance)? >