0

I am using firebase storage, a user publishes a photo and this happens without problems. When the same user publishes one more photo, the first one is deleted.

Need to set some rules?

Cutting some pieces my storage code looks like this:

var metadata = { contentType: fileObject.type };
                var storageRef = firebase.storage().ref();
                var uploadFile = storageRef.child(folder + '/' + filename).put(fileObject, metadata);
   uploadFile.on(firebase.storage.TaskEvent.STATE_CHANGED,
        function (snapshot) {
        var progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
        $timeout(function () {
        progressFn(progress);
        console.log(progress);
    });
},
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Gansonic
  • 347
  • 4
  • 15
  • 4
    If you upload a file to the same location/path it will overwrite any existing fle at that location/path. So you will need to ensure that the files you upload have a unique name on the server. See http://stackoverflow.com/questions/37444685/store-files-with-unique-random-names – Frank van Puffelen Mar 05 '17 at 23:28
  • Thank you, it helped me to clarify – Gansonic Mar 06 '17 at 00:05

0 Answers0