Bagaimana caranya Upload image ke storage firebase dengan nodejs

  function uploadFile() {
	//create a root refrence
	var filename = selectedFile.name;
	var storageRef = fire.storage().ref('/Images/' + filename);
	var uploadTask = storageRef.put(selectedFile);

	// Register three observers:
	// 1. 'state_changed' observer, called any time the state changes
	// 2. Error observer, called on failure
	// 3. Completion observer, called on successful completion
	uploadTask.on('state_changed', function(snapshot){
	  // Observe state change events such as progress, pause, and resume
	  // Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded
	}, function(error) {
	  // Handle unsuccessful uploads
	}, function() {
	  // Handle successful uploads on complete
	  // For instance, get the download URL: https://firebasestorage.googleapis.com/...
	  var downloadURL = uploadTask.snapshot.downloadURL;
	  console.log(downloadURL);
	});
}

itu adalah function uploadfile saya

avatar dimasafrizal
@dimasafrizal

3 Kontribusi 2 Poin

Diperbarui 7 tahun yang lalu

2 Jawaban:

ini yang saya tungu

avatar ardyhim
@ardyhim

289 Kontribusi 175 Poin

Dipost 7 tahun yang lalu

iya bang.. Soalnya saya masih baru menggunakan firebase jadi enggak tau sama sekali.

avatar dimasafrizal
@dimasafrizal

3 Kontribusi 2 Poin

Dipost 7 tahun yang lalu

Login untuk ikut Jawaban