'How to upload a file to firebase storage with absolute path of it instead of using URI in android studio

I don't wanna use a uri with user interaction I only need a file from an absolute path like "/storage/emulated/0/myapp/sample.jpg" is there any way to upload a file in that way please help

Note : I'm using java



Solution 1:[1]

hi my friend can fix this by only adding your fill path into the File Object, this way can obtain a valid URL, such as this example

var file = Uri.fromFile(File("path/to/images/rivers.jpg"))

and set the fill to putFile Function such as this

uploadTask = riversRef.putFile(file)

can you review everything from firebase documentation

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Azmi radi Azmi