Upload Files to Firebase Storage - Tutorial

Create a thread and hope someone will respond

or something that helped me to find something for my doubts was researching my problem in different languages, it’s harder to understand but you can use the automatic google translator :sweat_smile:


Why don’t work? ;-;

I’m need take a picture and upload it to firebase how do I do this? I didn’t find anything on the internet

There is some difference between your page_list object variable and the object that “Take photo” outputs. Be sure all the fields are exactly the same.

Excellent tutorial - did you figure out how to use in tandem with storage rules? e.g. allow upload only for authorized users? I’m stuck with this. I had to replace all Firebase Auth flow function provided out of the box and replace with HTTP requests to make the rules work with collections. But no luck with storage yet,

No I haven’t used storage rules yet.

1 Like

Can your share the firebase storage rules that works with “Firebase Storage upload files”? Mine not working. The rule I’m trying to implement is:
rules_version = ‘2’;
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=} {
allow read: if true;
}
match /{allPaths=
} {
allow write: if request.auth.uid !< null;
}
}
}

Since this is now blocking my requests - I had to open up my storage as public.

I’m using the HTTP Requests for all firebase auth steps as I was not being able to implement the Firestore database rules. Is this has a role to play?

Any idea what is going on here?

Thanks @JOHN_WORSHAM for this great tutorial.

I have one question, I save the pictures locally on the device (because I need it works in country areas where there is not internet), I move the images to a new folder, and I save the path in the local database.

Is there a way to upload the image if I save just the path?
Or do I have to save these images as objects (including the MimeType and the other properties?

Thanks in advance,
Edwin

Hello, I am new to appgyver, I would like to know if you can help me, how do I upload an image or file to the firebase storage with the new direct integration method, thanks

The youtube have good tutorials

not the answer i was hoping to get, but thanks

Maybe the Docs can help?

https://docs.appgyver.com/reference/flow_functions/data/firebase-storage-upload-files

Where do you have problems?
Flow would be:

  1. Pick files button.

  2. Bound button to Pick files flow function: https://docs.appgyver.com/reference/flow_functions/media/pick-files

  3. Use the Firebase storage upload files flow function (link above) and feed it the outputs[“Pick files”].response or .files.

+1. You might consider creating a firestore collection and also using a create new record to be able to easily keep track of the files. (Note by deleting the data record, you will not delete the file).

Since I am only selecting 1 file from Pick Files, the file index i want is always going to be [0]. So I use a WITH_ITEM function to append {outputs[“Pick files”].files[0]} to my initialized FileListObj variable. But this is wrapped with SET_KEY because I need to set the “uploadUrl” to the Firebase upload destination. So just copy the formula i use above, replacing “myprojectname” with your Firebase project name for the upload Url.

Hi,
Thanks for this great tutorial.
What would be the formula to pick multiple files ?

@JOHN_WORSHAM i am unable to select the page variable in upload file even after having the page variable and can u plz check what is the mistake in my formulae
.


Hi! You are using WITH_ITEM which is for lists. Your page variable is an Object, so if that is what you intend, skip the WITH_ITEM and just use the SET_KEY part.

@Gabriele_Fusco for multiple files, use the MAP formula function to SET_KEY instead.

1 Like

thank u so much @Mevi for helping me out , but still my formula part is highlighted in red color can u please check it and can I please know when u will upload part 3 video of messaging app ?

Upload Files requires a List of Objects type variable. You can’t use a single Object variable with Upload Files.

2 Likes

@Gabriele_Fusco for multiple files, use the MAP formula function to SET_KEY instead.

I can’t find the right formula. I tried for hours. Who would give me a little cup of hand ?
Thank you :pray:

1 Like

Hello, I have been trying for several days to upload not a file but a picture from the camera (from the flow take a picture).
“Pick files” works, but impossible to upload from a photo.
Is there a solution?
Thanks

@Gabriele_Fusco Something like MAP(whatyouwanttomap, SET_KEY(item, thekeyyouwanttoset, thevalueyouwanttoset)). Note that whatyouwanttomap must be List of Objects type. This would be the page variable or the output from another node, depending on your setup.

@Alexandre_Bonno take photo or pick image from library should work similarly, although may need some adjustments to your formula. What type of setup have you tried for them?