开发者

Creating a unique image name hash for a website with image uploads

开发者 https://www.devze.com 2023-03-22 13:42 出处:网络
I have a website that accepts user-uploaded images. I wa开发者_开发技巧nt to give each uploaded image a unique name. I will be physically storing the images on the file system and saving the file-name

I have a website that accepts user-uploaded images. I wa开发者_开发技巧nt to give each uploaded image a unique name. I will be physically storing the images on the file system and saving the file-name of the image in my database. What is a good way to accomplish this?


you can name it a substring of a md5 hash made of the users id and the time


I don't see any reason not to use an autogenerated ID field in the table and make that the file name as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号