0
votes

I am using the FirebaseStorage

I have already implemented uploading image files to storage.

Uploading image file is profile picture, but whenever I change profile picture, I do not want to have existing image file, so I want to reset every time I upload it.

Because I think it is a waste of space.

how to init firebase storage?

simple my code :

tmpimagelist.forEach((f) {
        final StorageReference _ref =
            FirebaseStorage.instance.ref().child('${foldername}/${num++}.jpg');
        final StorageUploadTask uploadTask = _ref.putFile(f);
        StorageTaskSnapshot storageTaskSnapshot;
1

1 Answers

0
votes

You used unique path every time which create unique child for the database. So instead, use static path.

e.g -> profile.jpg

FirebaseStorage.instance.ref().child('profile.jpg');