Answers for "how to upload file in firebase storage"

1

how to upload files to firebase storage

async function uploadBlob(file: Blob | Uint8Array | ArrayBuffer, path: string) {
  try {
    const uploadTaskSnapShot = await storage.ref(path).put(file);
    let url: string = await uploadTaskSnapShot.ref.getDownloadURL();
    return url;
  } catch (error) {
    throw new Error("Could not upload file");
  }
}
Posted by: Guest on September-07-2021
0

How to get the date and time when uploading image to firebase?

You can use ServerValue.TIMESTAMP provided by the Firebase database server and
store it in a new timestamp field in your database along with the url and
description fields for each image. The Firebase servers write the current
timestamp in UTC milliseconds in place of this value when performing writes. 
This value is a 13-digit numeric value.

 mDatabaseRef.child(uploadID).child("timestamp").setValue(ServerValue.TIMESTAMP);
Posted by: Guest on October-06-2020

Code answers related to "how to upload file in firebase storage"

Browse Popular Code Answers by Language