File element preview


Image I have a data type called “Files”, and has 2 fields, “file” (file) and “name” (text). Then, I have a RG with all files, and when I click on a file, a popup appears and I can view the file. When I upload an image (.png, .jpg, etc…), I need an image element in that popup, if it´s a PDF (.pdf) I need a PDF viewer, if it´s a video (.mp4, .mov, etc…) I need a video element, and so on.

I need to retrieve the file extension when uploading it and then have conditions to show the correct element? or is there a better approach.

Is there a way to preview every file with the same element?

Thanks in advance :slightly_smiling_face: :computer:

One simpler way would be to take advantage of the browser’s rendering capabilities:

Group the row elements as one group. Expand it to the cell’s dimensions. Place a link on the cell of the rg to be on top of this element. Set it to be transparent.

Add the expression “current cell … thing’s file” in the box “destination url”

Set the link destination to “external url” and set it to open in a new tab

The browser should render the different file types appropriately

Yes, I think that´s easier, thanks, @cmarchan.

The thing is that I would like to render the file inside a popup with the app´s own branding and all that, also, the files are private files, so the link won´t really work I suppose

This topic was automatically closed after 70 days. New replies are no longer allowed.