Fetching file from Storage Bucket in Apps Studio

Hi. I’m building an app which allows the user to change their profile picture. To do that, I created a storage bucket called ‘Profile Pictures’. In my app, I have a file picker element in the My Settings page. In the Create rule for when a file is uploaded, I did the following.

Can you tell me what’s wrong? The image binding is not being changed. Nothing happens.

Look dismiss the above the value is changing normally there’s nothing wrong but I got another issue now. The change is not permanent. As soon as I refresh the page or go to the starting home page, it defaults back to the previous profile pic. How to make it permanent?

Profile pic is now semi permanent. After removing the image binding and inserting the app variable, as follow, it stays when moving from page to page. But as soon as the app is refreshed, then the image is gone.

2023-05-20_142227

How to make it completely permanent even if the app is refreshed? Image binding field unfortunately only supports inserting images without app variables. App Studio has many missing features. I can upload and get files from a bucket but there is no option to even delete a file from it. The profile picture changing is dysfunctional as of currently. Hope the dev team can look into this post and add the necessary functionalities.

You can have Data services/entities here. The profile picture can be connected to the file column of entity. So whenever user updates a picture from app, the entity is updated with the user selected image and so the profile picture will be updated as latest since it refer to the entity column.
An example screenshot :
image
The “UserImage” variable is the binding variable for file picker.

Hey @Anas-p-v

I created the entity record as follows, but how do I get the file from that entity? There is no option.

2023-05-22_130531

In the entity, don’t choose the column, use the lookup function to get the record only and then update the file picker variable value to corresponding column below. Attaching screenshot below (havent mentioned image variable on screenshot, to show lookup fn)
image

I tried the following but its not working

There’s something wrong in the expression where I have an arrow pointed out.

In the lookup, you will have to give a condition, something like matching an id, or a name, by which you will be able to identify the row in entity that needs to be updated.

Yes but I’m not trying to lookup an existing record that is already there. I want the user to as soon as they upload the profile picture file to the entity to fetch that exact file name so that it can be automatically set on the image.

Rather than just having image, have one more column say email or userid, populate a value for that in data service, then do a lookup to that, update image column corresponding to that, also map image placeholder with the same column.

Look I got it working.

In the file picker event click, I did this

and also binded the same on the image itself in the URL/Binding field as such:

Now the profile picture is automatically loaded when a file is uploaded even after refreshing the app. However, the file pic takes around 1.5 seconds every time I navigate from page to page. :sweat_smile: :sweat_smile: :sweat_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.