Does Firebase store a unique file ID?

So the realtime database offers me a direct way to refer to a node using its id. So far, I've seen examples of Firebase repositories using the filename to create a link. What if two files have the same name? Should I prevent the user from uploading duplicate filenames? The url is unique, but as far as I know, you cannot create a link to a file based on it. There is something I'm missing because it doesn't feel right to me. Thanks for your help.

+4


source to share


1 answer


In Firebase Storage, you can define the filename when uploading a file. There is no built-in method to create a unique file name for Firebase storage (like a method push()

in a database).

If you have two references to the same path, they will refer to the same file in Firebase storage.



If you want globally unique filenames, you'll have to generate them yourself. One way is to use the Firebase Database method push()

, but you can also use any other GUID generator for your platform.

+6


source







All Articles