File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,15 @@ uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED, // or 'state_changed'
150
150
// Upload completed successfully, now we can get the download URL
151
151
var downloadURL = uploadTask . snapshot . downloadURL ;
152
152
console . log ( "The download URL: " + downloadURL ) ;
153
+
154
+ //this is where you have to enter the code to update any desired firebase table with the image url
155
+ //eg this below code will add a 'profilePhoto' field and record to 'users' table for the user with the id of userId
156
+ //read more about saving data in firebase here: https://firebase.google.com/docs/database/web/save-data
157
+
158
+ firebase . database ( ) . ref ( 'users/' + userId ) . update ( {
159
+ profilePhoto : downloadURL
160
+ } ) ;
161
+
153
162
} ) ;
154
163
155
164
@@ -159,7 +168,7 @@ uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED, // or 'state_changed'
159
168
function onFail ( message ) {
160
169
//alert('Failed because: ' + message);
161
170
setTimeout ( function ( ) {
162
- navigator . notification . alert ( message ) ;
171
+ navigator . notification . alert ( message ) ; //show a pop up message if something failed in the process eg.image upload canceled
163
172
} , 0 ) ;
164
173
}
165
174
You can’t perform that action at this time.
0 commit comments