Camera photo for firebase storage.

I’m trying to send a photo from the camera to firebase.storage, but it returns this error: Firebase Storage: Invalid argument in put at index 0: Expected Blob or File.

How to send blob or file?

takePicture does not return a File. As described in the documentation, what you get is an object with a file path, a width and a height. I suspect what you’d do in your case is firebase.storage().ref(image.path) where image is the object you receive in the takePicture promise.

var task = storageRef.put(file.path);

It also does not work, it just does not respond.

In addition to what andreas said about the path. I think you get an error from Firebase that they can’t send blobs. That is not supported yet, but right around the corner.

Anders, the firebase accepts blob, but the camera does not return a blob, it returns a json.

Firebase uses blobs but Fuse does not support blob yet, so it will not work. Camera does not return JSON but a JavaScript object with a path property.

What is the best way to upload image to server with fuse?

XMLHttpRequest are able to upload ArrayBuffers. Until blob support is out I think that is the best way.

looking forward to blobs, any Uno/Foreign code alternative at the moment?