firebase
firebase copied to clipboard
[Firebase-storage][Android] Error: An unknown error occurred, please check the HTTP result code and inner exception for server response.
Error: An unknown error occurred, please check the HTTP result code and inner exception for server response.
const file = File.fromPath(files.files[0], true);
gives me
"_path": "/storage/emulated/0/Download/877981_QSG_SSB600-SOUNDBAR_ml.pdf", "_name": "877981_QSG_SSB600-SOUNDBAR_ml.pdf", "_extension": ".pdf"
Upload
firebase()
.storage()
.ref()
.child(remoteFullPath) // Firebase url
.putFile(localFullPath) // /storage/emulated/0/Download/877981_QSG_SSB600-SOUNDBAR_ml.pdf
.on('state_changed', {
complete() {
console.info('uploadFile', 'completed');
},
error(err) {
console.error('uploadFile', 'error', err);
},
next(snapshot) {
console.info('uploadFile', 'next', 'state', snapshot.state);
if (snapshot.totalBytes) {
console.log('uploadFile', 'next', 'progress %', snapshot.bytesTransferred / snapshot.totalBytes ?? 0 * 100);
}
if (snapshot.error) {
console.error('uploadFile', 'next', snapshot.error);
}
},
});
Any ideas?
One thing I should add is that the above is the nativescript ui-document-picker. Using the nativescript-image picker if I create an image and store it in my app's directory the above works fine with the following url.
/data/user/0/org.nativescript.app/files/app-name/filename.ext