Cloud Storage for Firebase: uploading of base64 string on Web fails
I have read quite a few posts about this (e.g. Save base64 encoded image to Firebase Storage) but cannot make it work.
I am using the example from https://firebase.google.com/docs/storage/web/upload-files#upload_from_a_string (doing this in React Native):
console.log('Writing a base64 string');
ref = await firebase.storage().ref('test').child(Date.now().toString());
message = '5b6p5Y+344GX44G+44GX44Gf77yB44GK44KB44Gn44Go44GG77yB';
await ref.putString(message, 'base64').then(snapshot => {
console.log('.... Done');
});
And I get the following error:
[17:53:23] Possible Unhandled Promise Rejection (id: 0):
[17:53:23] FirebaseStorageError {
[17:53:23] "code_": "storage/invalid-format",
[17:53:23] "message_": "Firebase Storage: String does not match format 'base64': Invalid character found",
[17:53:23] "name_": "FirebaseError",
[17:53:23] "serverResponse_": null,
[17:53:23] }
firebase react-native firebase-storage
add a comment |
I have read quite a few posts about this (e.g. Save base64 encoded image to Firebase Storage) but cannot make it work.
I am using the example from https://firebase.google.com/docs/storage/web/upload-files#upload_from_a_string (doing this in React Native):
console.log('Writing a base64 string');
ref = await firebase.storage().ref('test').child(Date.now().toString());
message = '5b6p5Y+344GX44G+44GX44Gf77yB44GK44KB44Gn44Go44GG77yB';
await ref.putString(message, 'base64').then(snapshot => {
console.log('.... Done');
});
And I get the following error:
[17:53:23] Possible Unhandled Promise Rejection (id: 0):
[17:53:23] FirebaseStorageError {
[17:53:23] "code_": "storage/invalid-format",
[17:53:23] "message_": "Firebase Storage: String does not match format 'base64': Invalid character found",
[17:53:23] "name_": "FirebaseError",
[17:53:23] "serverResponse_": null,
[17:53:23] }
firebase react-native firebase-storage
Are you sure that's a valid base64 string?
– Doug Stevenson
Nov 13 '18 at 16:39
I took this from the example in firebase.google.com/docs/storage/web/…. I also tried shorter strings, like 'dGV4dA==' (encoded 'text' in base64encode.org)
– Yossi
Nov 13 '18 at 16:47
Then you should file a bug report. firebase.google.com/support/contact/bugs-features
– Doug Stevenson
Nov 13 '18 at 16:49
Thanks Doug, I will. It seems, however, that it works for some people... See stackoverflow.com/questions/37352884/….
– Yossi
Nov 13 '18 at 17:01
Thanks to @soutot it works. See: stackoverflow.com/questions/52157253/…
– Yossi
Nov 13 '18 at 21:30
add a comment |
I have read quite a few posts about this (e.g. Save base64 encoded image to Firebase Storage) but cannot make it work.
I am using the example from https://firebase.google.com/docs/storage/web/upload-files#upload_from_a_string (doing this in React Native):
console.log('Writing a base64 string');
ref = await firebase.storage().ref('test').child(Date.now().toString());
message = '5b6p5Y+344GX44G+44GX44Gf77yB44GK44KB44Gn44Go44GG77yB';
await ref.putString(message, 'base64').then(snapshot => {
console.log('.... Done');
});
And I get the following error:
[17:53:23] Possible Unhandled Promise Rejection (id: 0):
[17:53:23] FirebaseStorageError {
[17:53:23] "code_": "storage/invalid-format",
[17:53:23] "message_": "Firebase Storage: String does not match format 'base64': Invalid character found",
[17:53:23] "name_": "FirebaseError",
[17:53:23] "serverResponse_": null,
[17:53:23] }
firebase react-native firebase-storage
I have read quite a few posts about this (e.g. Save base64 encoded image to Firebase Storage) but cannot make it work.
I am using the example from https://firebase.google.com/docs/storage/web/upload-files#upload_from_a_string (doing this in React Native):
console.log('Writing a base64 string');
ref = await firebase.storage().ref('test').child(Date.now().toString());
message = '5b6p5Y+344GX44G+44GX44Gf77yB44GK44KB44Gn44Go44GG77yB';
await ref.putString(message, 'base64').then(snapshot => {
console.log('.... Done');
});
And I get the following error:
[17:53:23] Possible Unhandled Promise Rejection (id: 0):
[17:53:23] FirebaseStorageError {
[17:53:23] "code_": "storage/invalid-format",
[17:53:23] "message_": "Firebase Storage: String does not match format 'base64': Invalid character found",
[17:53:23] "name_": "FirebaseError",
[17:53:23] "serverResponse_": null,
[17:53:23] }
firebase react-native firebase-storage
firebase react-native firebase-storage
edited Nov 13 '18 at 16:37
Doug Stevenson
72.7k983104
72.7k983104
asked Nov 13 '18 at 16:00
YossiYossi
1,6032720
1,6032720
Are you sure that's a valid base64 string?
– Doug Stevenson
Nov 13 '18 at 16:39
I took this from the example in firebase.google.com/docs/storage/web/…. I also tried shorter strings, like 'dGV4dA==' (encoded 'text' in base64encode.org)
– Yossi
Nov 13 '18 at 16:47
Then you should file a bug report. firebase.google.com/support/contact/bugs-features
– Doug Stevenson
Nov 13 '18 at 16:49
Thanks Doug, I will. It seems, however, that it works for some people... See stackoverflow.com/questions/37352884/….
– Yossi
Nov 13 '18 at 17:01
Thanks to @soutot it works. See: stackoverflow.com/questions/52157253/…
– Yossi
Nov 13 '18 at 21:30
add a comment |
Are you sure that's a valid base64 string?
– Doug Stevenson
Nov 13 '18 at 16:39
I took this from the example in firebase.google.com/docs/storage/web/…. I also tried shorter strings, like 'dGV4dA==' (encoded 'text' in base64encode.org)
– Yossi
Nov 13 '18 at 16:47
Then you should file a bug report. firebase.google.com/support/contact/bugs-features
– Doug Stevenson
Nov 13 '18 at 16:49
Thanks Doug, I will. It seems, however, that it works for some people... See stackoverflow.com/questions/37352884/….
– Yossi
Nov 13 '18 at 17:01
Thanks to @soutot it works. See: stackoverflow.com/questions/52157253/…
– Yossi
Nov 13 '18 at 21:30
Are you sure that's a valid base64 string?
– Doug Stevenson
Nov 13 '18 at 16:39
Are you sure that's a valid base64 string?
– Doug Stevenson
Nov 13 '18 at 16:39
I took this from the example in firebase.google.com/docs/storage/web/…. I also tried shorter strings, like 'dGV4dA==' (encoded 'text' in base64encode.org)
– Yossi
Nov 13 '18 at 16:47
I took this from the example in firebase.google.com/docs/storage/web/…. I also tried shorter strings, like 'dGV4dA==' (encoded 'text' in base64encode.org)
– Yossi
Nov 13 '18 at 16:47
Then you should file a bug report. firebase.google.com/support/contact/bugs-features
– Doug Stevenson
Nov 13 '18 at 16:49
Then you should file a bug report. firebase.google.com/support/contact/bugs-features
– Doug Stevenson
Nov 13 '18 at 16:49
Thanks Doug, I will. It seems, however, that it works for some people... See stackoverflow.com/questions/37352884/….
– Yossi
Nov 13 '18 at 17:01
Thanks Doug, I will. It seems, however, that it works for some people... See stackoverflow.com/questions/37352884/….
– Yossi
Nov 13 '18 at 17:01
Thanks to @soutot it works. See: stackoverflow.com/questions/52157253/…
– Yossi
Nov 13 '18 at 21:30
Thanks to @soutot it works. See: stackoverflow.com/questions/52157253/…
– Yossi
Nov 13 '18 at 21:30
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284885%2fcloud-storage-for-firebase-uploading-of-base64-string-on-web-fails%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284885%2fcloud-storage-for-firebase-uploading-of-base64-string-on-web-fails%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you sure that's a valid base64 string?
– Doug Stevenson
Nov 13 '18 at 16:39
I took this from the example in firebase.google.com/docs/storage/web/…. I also tried shorter strings, like 'dGV4dA==' (encoded 'text' in base64encode.org)
– Yossi
Nov 13 '18 at 16:47
Then you should file a bug report. firebase.google.com/support/contact/bugs-features
– Doug Stevenson
Nov 13 '18 at 16:49
Thanks Doug, I will. It seems, however, that it works for some people... See stackoverflow.com/questions/37352884/….
– Yossi
Nov 13 '18 at 17:01
Thanks to @soutot it works. See: stackoverflow.com/questions/52157253/…
– Yossi
Nov 13 '18 at 21:30