Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload image to firebase and set a link in database

I know how to add data to the firebase database, I know how to upload image to the firebase storage. I am doing this in javascript.

I am not able to figure out how to link the image to my database object.

My database object is something like this

{
name:'alex',
age:23,
profession:'superhero'
image:*what to put here ???*
}

One idea is to use the object reference that is created and store the image using the same reference.

Any tutorial or ideas appreciated.

like image 490
Gaurav_soni Avatar asked Dec 28 '25 20:12

Gaurav_soni


1 Answers

We often recommend storing the gs://bucket/path/to/object reference, otherwise store the https://... URL.

See Zero to App and it's associated source code (here we use the https://... version) for a practical example.

like image 106
Mike McDonald Avatar answered Dec 30 '25 09:12

Mike McDonald



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!