What if a file already exists with that name? You'd overwrite it without the user noticing it. (It could, the method to generate the file name doesn't ensure an unique name). You should iterate updating the file name until the file doesn't exist.