Impossible to upload Base64 image to Firebase Storage

1,829 views
Skip to first unread message

Khrystyna Skvarok

unread,
Oct 27, 2016, 12:52:59 PM10/27/16
to Firebase Google Group
Hi!

Each time I try to use putString() method to upload Base64 encoded image, I get next error:

  1. "storage/invalid-format"
  2. message:"Firebase Storage: String does not match format 'base64url': Invalid character '+' found: is it base64 encoded?"
  3. name:"FirebaseError"
  4. serverResponse:null  
I tried to remove 'data:image/png;base64,' at the beginning of image string, but it doesn't help. Could you please help? Thanks a lot!  

Spencer Phippen

unread,
Oct 27, 2016, 1:17:33 PM10/27/16
to Firebase Google Group
Hey Khrystyna,

Based on the error message it looks like you have a '+' character in your string.
That makes me think the string content is probably base64 formatted, not base64url (if you're not familiar with the difference, it's detailed in RFC 4648: https://tools.ietf.org/html/rfc4648#section-5 ).
I'm not sure this is the issue since you haven't posted any repro code here, but I'd guess that you're calling

putString(firebase.storage.StringFormat.BASE64URL, ...) // or putString('base64url', ...)

when you should be calling

putString(firebase.storage.StringFormat.BASE64, ...) // or putString('base64', ...)

- Spencer

Ronaldo Freitas

unread,
Mar 1, 2018, 11:04:24 AM3/1/18
to Firebase Google Group

use this:

.putString(imageBase64, 'data_url')
Reply all
Reply to author
Forward
0 new messages