Reputation: 2902
I would like to rename my uploaded files using some reGex before I store them in the firebase storage.
As much as I know now, firebase file metadata doesn't allow that. I was wondering if there is anyway possible to do that. I am using angularjs.
Upvotes: 2
Views: 4140
Reputation: 97
Property Type Writable
bucket string NO
generation string NO
metageneration string NO
fullPath string NO
name string NO
Unfortunately not, name is not editable property: https://firebase.google.com/docs/storage/web/file-metadata#file_metadata_properties
Upvotes: 1
Reputation: 599776
When you upload a file to Firebase Storage, you explicitly specify the name that the file gets. From the documentation on uploading files:
// Create a root reference
var storageRef = firebase.storage().ref();
// Create a reference to 'mountains.jpg'
var mountainsRef = storageRef.child('mountains.jpg');
Now it doesn't matter what file you upload, it will be named mountains.jpg
in Firebase Storage. For example:
var file = ... // use the Blob or File API
mountainsRef.put(file).then(function(snapshot) {
console.log('Uploaded a blob or file!');
});
Upvotes: 2