Skip to content

Instantly share code, notes, and snippets.

@nataliaconde
Last active July 7, 2020 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nataliaconde/bf209b901b06df420bcc0f264fce6ad2 to your computer and use it in GitHub Desktop.
Save nataliaconde/bf209b901b06df420bcc0f264fce6ad2 to your computer and use it in GitHub Desktop.
Firebase Storage: What It Is and How It Works
var storageRef = firebase.storage.ref("folderName/file.jpg");
var fileUpload = document.getElementById("fileUpload");
fileUpload.on('change', function(evt) {
var firstFile = evt.target.file[0];
var uploadTask = storageRef.put(firstFile);
uploadTask.on('state_changed', function progress(snapshot) {
console.log(snapshot.totalBytesTransferred);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment