I was trying to upload image to Firebase Store using Imagepicker library,
But in console it's showing the format as application/octet-stream because of that the image is not visible. Is there any possible way to convert that format to image in dart itself while uploading.
Either pass a file extension to the file name when you upload
FirebaseStorage.instance
.ref()
.child(path)
.child('image.jpg');
or pass metadata
FirebaseStorage.instance
.ref()
.child(path)
.child('image');
imageStore.putFile(file, StorageMetadata(contentType: 'image/jpeg'));
https://firebase.google.com/docs/storage/web/upload-files#add_file_metadata
Add File Metadata
When uploading a file, you can also specify metadata for that file. This metadata contains typical file metadata properties such as name, size, and contentType (commonly referred to as MIME type). Cloud Storage automatically infers the content type from the file extension where the file is stored on disk, but if you specify a contentType in the metadata it will override the auto-detected type. If no contentType metadata is specified and the file doesn't have a file extension, Cloud Storage defaults to the type application/octet-stream. More information on file metadata can be found in the Use File Metadata section.
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