in app.module
AngularFireModule.initializeApp(environment.firebaseConfig)
I have two storage
firebaseConfig: {
apiKey: 'AIzaSyBHsAxVgiuM0_xLd3BunTG6Yf9x1nynxoA',
authDomain: 'careerograph-e9963.firebaseapp.com',
databaseURL: 'https://careerograph-e9963.firebaseio.com',
projectId: 'careerograph-e9963',
storageBucket: 'careerograph-e9963.appspot.com',
messagingSenderId: '669874223858'
},
firebaseExcelConfig: {
apiKey: 'AIzaSyBHsAxVgiuM0_xLd3BunTG6Yf9x1nynxoA',
authDomain: 'careerograph-e9963.firebaseapp.com',
databaseURL: 'https://careerograph-e9963.firebaseio.com',
projectId: 'careerograph-e9963',
messagingSenderId: '669874223858',
storageBucket: 'careerograph-excel',
},
in component I inject in contructor private storage: AngularFireStorage then call
this.task = this.storage.upload(this.path, file, { customMetadata });
How can I choose a bucket to upload file to it
In the documentation you can see:
// Get a non-default Storage bucket
var storage = firebase.app().storage('gs://my-custom-bucket');
The reference of the storage you have to define is in this way:
var storageRef = firebase.app().storage('my-custom-bucket').ref();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With