Issue to load a image blob for firebase
See original GitHub issueHi my name is Kevin, and I am having a issue when I try to convert a uri to a blob.
I actually I am using the version 0.55 of react native and 0.10.12 of the library and this is my code
` uploadImage = (mime = ‘image/jpeg’, name) => { const Blob = RNFetchBlob.polyfill.Blob; const fs = RNFetchBlob.fs; window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest; window.Blob = Blob; var uri = this.props.image;
return new Promise((resolve, reject) => {
let imgUri = uri; let uploadBlob = null;
const uploadUri = Platform.OS === 'ios' ? imgUri.replace('file://', '') : imgUri;
const { currentUser } = auth;
const imageRef = storage.ref(`/images/${currentUser.uid}`)
fs.readFile(uploadUri, 'base64')
.then(data => {
return Blob.build(data, { type: `${mime};BASE64` });
})
.then(blob => {
uploadBlob = blob;
return imageRef.put(blob, { contentType: mime, name: name });
})
.then(() => {
uploadBlob.close()
return imageRef.getDownloadURL();
})
.then(url => {
resolve(url);
})
.catch(error => {
reject(error)
})
})
}`
When I run this line window.Blob = Blob;
I am getting this error
I read this issue in react-native-fetch-blob, but this does not have any solution
Thanks to read my problem and thanks for your work
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10
Top Results From Across the Web
Uploaded Image Blob To Firebase - Missing Next Steps
Try using Firebase Storage to store the blob in a correct place while getting a downloadableUrl const uploadFile = async = (blob) =>...
Read more >Upload files with Cloud Storage on Web - Firebase
To upload a file to Cloud Storage, you first create a reference to the full path of the file, including the file name....
Read more >Image optimization with Firebase Extensions - Invertase
Image optimization with Firebase Extensions. In this blog, the use-case discussed is about images and Cloud Storage triggers.
Read more >Uploading Images to Firebase Storage (and retrieving them)
Firebase is a platform that contains many useful features including the Firestore database which we've used in the past.
Read more >Evan Bacon on Twitter: "Firebase storage upload doesn't work ...
and your file will be 0kb on Firebase. Anyone who knows RN Blob API S.O.S ❤️" / Twitter ... I have no problem...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ManalLiaquat I’d be glad to help, but I don’t use
expo
in my projects.@sertony Maybe it helps you See this gist