Uploading picture fails

  • Replies:0
  • OpenNot stickiedUnanswered
  • Forum posts: 1

Jul 15, 2016, 5:22:18 PM via Website

hey guys,i am using firebase and i try to upload a picture using their method upload from a local file.

"UploadTask uploadTask = currentPicRef.putFile(file, metadata);"

When the user pick's image from the gallery or taking a picture via the camera the picture is saved in external storage and I save the uri in shared preference.

I successfully loaded the image into an imageview using the setImageURI(uri) method, but When I call the firebase method and using the same uri "Uri file = Uri.fromFile(new File(fileName));"
I get the error

"could not locate file for uploading:file:///content%3A/media/external/images/media/22943"

but when I use log to check the local file I get

"uri is content://media/external/images/media/22943"

also worth to mention that when I used uri.parse() instead uri.fromFile() in firebase to upload from a local file it uploaded the metadata but not the photo itself.

Any ideas how to fix it?

Recommended by NextPit