Skip to content Skip to sidebar Skip to footer

Firebase Firestorage Upload Process Jump From 0 To 100

I am implementing a file upload using Angular and Firebase. When I am uploading an image I want to show a smooth transition from 0 to 100. But right now I am using firebase's built

Solution 1:

You are dividing snapshot.bytesTransferred / snapshot.totalBytes which evaluates to 0 and then multiplying it with 100 give u zero, instead multiply it with 100 first and then divide it by total size

use the following formula

this.selectedImageUrl = (snapshot.bytesTransferred *100) / snapshot.totalBytes; 

Solution 2:

The behavior you're observing can't be changed.

Internally, the SDK uses a large buffer to send the contents of the file, and the progress only updates after an entire buffer is sent. If you're sending a small file, it's very possible that a single buffer contains the entire file. There's nothing you can do to change the size of the internal buffers, so you'll have to accept the way that it works today.

Post a Comment for "Firebase Firestorage Upload Process Jump From 0 To 100"