Images stored in the app variable disappear after some time

How long do images get stored in an app variable? I’m making an where an admin an uploads images in a database then the images get displayed to the users. after opening pictures on the phone I store the chosen image in an app variable and when they press upload It uploads it on the database. but I’ve realised that after some time the images stored in an app variable disappears meaning that no images are displayed to users

Hi,

How are you storing your images? Composer uses Amazon S3 as a default, and the uploadUrl and downloadUrl that come along with it are temporary and expire in a while, which could explain why the images disappear.

I stored the images in an app variable then when a user press “save” the value in the app variable is stored in a database(RestDB). How can I make an image that I selected to be stored the for long so that it doesn’t disappear after some time?

I don’t have much experience with rest DB and image uploading, but I’m guessing this is an issue with the url to the picture expiring. A storage key is the only permanent reference to the image, here’s a forum topic covering a similar issue, if this would help you. Let me know if you need more help with this!

1 Like

Thanks for replying. Please have a look at the picture below, How can I store the image so it only upload to the database when a user press save? I tried to store the bucket url in an app variable but it didn’t work.

The flow looks like it should work and be saved after the save button is tapped. In what way didn’t it work, are you able to locate which node fails? You can do this by putting alerts to the failing outputs

I couldn’t get any warnings. It seems like everything is working well but for some reason nothing gets stored in the app variable. I have two buttons. first(“Attachment”) one is for getting the image from the device then store in the app variable and the other one (“Save”) is for uploading the image

Ah now I see what you mean. So in the attachment phase, you can just directly set the app variable after the pick pick image flow function. If you want to display the photo, you can use the local file path that is available in the picture object. Then when you press save, you can do the Get bucket upload URLs and Upload Files flow with the app variable.

This is how the “Save” logic function looks like. Can you advice on how I can go about it?

When you press the save button it also creates a record(RestDB) hence I need the link to be stored in a variable so it can be included in the create record(Please check the second picture)

What link do you mean? Get bucket upload URL attaches the uploadUrl directly to the image file. You can also access it by outputs["Get bucket upload URLs"].files[0].uploadUrl, if you want to separately store it in a variable.