Uploading an image or a string to firebase is not working on Android, but working in browser


#1

Since about 3 days I am trying to upload an image to the firebase storage without success.

I tried several approaches. It is even not possible to upload a simple string.

Running the app in the browser is working fine for images and strings.

Emulator and phone returns the same error:
Firebase Storage: An unknown error occurred, please check the error payload for server response.

Reading out the error object with “error.serverResponse” returns following:
“Multipart body does not contain 2 or 3 parts”

This is my upload function:

$scope.upload = function() {

    //storage reference
          var storage = firebase.storage();

          //path reference
          var storageRef = storage.ref();
          var uploadTask = storageRef.child('testfile.png').putString("any string").then(function(snapshot) {
                      console.log('upload successful');
                      alert('ok');
                    }, function (error) {
                      // Handle unsuccessful uploads
                      //alert(error.message);
               alert(error.serverResponse);
                    });