savagenoob Posted October 5, 2010 Share Posted October 5, 2010 Whats the easiest way to rename uploaded files to a unique name that would never be duplicated? Quote Link to comment Share on other sites More sharing options...
rwwd Posted October 5, 2010 Share Posted October 5, 2010 I don't think as that would be possible, unless you wrote in a clause to say if this exists, generate another, but personally functions like rand(0,999); and shuffle() could help generate a string:- $arrayOfChars = str_split('0123456789QWERTYUIOPASDFGHJKLZXCVBNM'); shuffle($arrayOfChars); echo $arrayOfChars[rand(0,36)].$arrayOfChars[rand(0,36)].$arrayOfChars[rand(0,36)]; something like that would produce a string with 'jumbled' content that would have countless permutations.. I must stress, this is just for example, it may not work like that; but I think it could ;-p Rw Quote Link to comment Share on other sites More sharing options...
litebearer Posted October 5, 2010 Share Posted October 5, 2010 using the date/time as the name - would generaly produce and ordered filename system Quote Link to comment Share on other sites More sharing options...
plznty Posted October 6, 2010 Share Posted October 6, 2010 Use a sequence with a very large amounts of permutations available, then check if file exists, if exists from another and loop it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.