I want to create unique filenames for each uploaded file (Similar to this), but regardless of the extension (ie, name.txt and name.dxf is a clash)
I'm converting files on my server (ie, ogg, wav, etc) to a particular filetype extension, ie. mp3, and then removing the original file.
This issue is if someone uploads a file with different extension but the same base name, then the conversion will override the original file.
I can obviously do a check if the target file already exists. I know Django will also generate some sort of unique identifier (appended to the uploaded filename) such as "_HVk3AIt" if there is a conflict with an exact filename match. Is this a UUID?
I originally though adding a randomly generated UUID would be a bad solution because even though 2^128 is like 4*10^38 (little chance of clash) you could technically override something eventually, but I guess you just keep checking the new proposed filename, and add secondary UUID if you've got a second collision etc.
Is this a good solution, or what is standard practise for such a problem?