Reputation: 399
Background:
Specifications:
firebase.functions().httpsCallable
functions.https.onCall
Question:
How can firebase.functions().httpsCallable
submit files to functions.https.onCall
?
Thank you in advance.
ABC.
Upvotes: 8
Views: 3181
Reputation: 317788
That's not really an intended use case for callable functions. Callables are meant to send a JSON payload to the server, not a file. If you really want to send a (small) file to a function, you'll need to base64 encode it as a string, and put that string in the JSON payload, then decode it in the function.
Instead, consider allowing the client to upload directly to storage, then use a function to validate it with a storage trigger, and delete it if it's not valid.
Upvotes: 6