Same file has already been attached to the record

For uploading file, if using the same name file, it will be duplicated. How can I make a random name when uploading to system?