Create Unique Image Names

前端 未结 15 2187
暗喜
暗喜 2021-01-06 08:02

What\'s a good way to create a unique name for an image that my user is uploading?

I don\'t want to have any duplicates so something like MD5($filename) isn\'t suita

15条回答
  •  感情败类
    2021-01-06 08:33

    http://php.net/manual/en/function.uniqid.php maybe?

    • You can prefix it with the user id to avoid collisions between 2 users (in less than one millisecond).

提交回复
热议问题