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

Time:01-07

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:

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

CodePudding user response:

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.

  • Related