Can I get file from Firebase Storage while not knowing one child path?

I have this file path from Firebase Storage that I want to download:

/students/ekljfbwekncwlkjbweclk/gpas/this part is random/4

If I do not know the child path "this part is random", can still download the file?

I tried this:

// This is what I tried
.child("4").downloadUrl.addOnSuccessListener { uri ->
   Log.i(TAG, "Success! Uri is: $uri")
}.addOnFailureListener { e ->
   Log.e(TAG, "Failed to retrieved photo. Exception is: $e")

>Solution :

You must know the full path of the file in order to download it.

The only way for a Firebase Storage client app to discover the name of a path component that you don’t know is using list API.

You’re probably better off recording that random bit somewhere in a database so you can more easily find and use it again.

Leave a Reply