-
-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(storage): pass file metadata through uploadFile to storage.put #720
Comments
You can specify |
Thank you for your reply @prescottprue ... Yes, I've tried it several times but it does not work. |
@JorgeMoralesLopez It actually appears that file metadata wasn't being passed along, so I started to work on that as a new feature for an upcoming version. The new syntax will look like so: const storagePath = 'avatars'
const dbPath = 'avatarFilesInfo'
const fileMetadata = { contentType: 'image/jpeg' }
firebase
.uploadFile(storagePath, file, dbPath, { metadata: fileMetadata })
.then(() => {
console.log('File uploaded successfully')
}) |
Thank you @prescottprue, I'm glad to hear that I was not on the wrong path because I searched the web and tried many ways. "firebase": "^5.4.1", |
* feat(storage): pass file metadata through `uploadFile` to `storage.put` calls - #720 * fix(auth): pass `updateProfile` options to action - #701 - @cruzdanilo * fix(profile): only include `providerData` if it is not an empty array in Firestore - #699 * feat(webpack): add `lodash-webpack-plugin` to shrink bundle size
Fix included in v2.3.0 release including a docs update with an example. Reach out if it doesn't work as expected. Thanks for reporting! Will release to |
I comment this issue because the feature was not released on |
I'm doing login with facebook and when I enter the profile image in firebase storage I get a file with extension application / octet-stream, I need this file to have jpg, jpeg, png image format ... How can I put contentType?
const firebaseLib = getFirebase() const imageName = uuid.v4(); const path =
${user.uid}/user_images`const options = {
name: imageName,
};
const response = await urlToBlob(user.photoURL + '?type=large');
//upload the file to firebase storage
let uploadedFile = await firebaseLib.uploadFile(path, response, null, options)
// console.log('uploadedFile', uploadedFile);
// get url of image de firebase storage
let downloadURL = await uploadedFile.uploadTaskSnapshot.ref.getDownloadURL();
`
The text was updated successfully, but these errors were encountered: