File download with dynamic link

How to achieve this on dynamic link inside repeat region?

You can pass the dynamic file name from the repeat to the download action, as a parameter.

May I have more specific instruction, because from the step above, the link to the file is static. I’ve tried to use $_GET to pass the dynamic file to the file path on click event e.g./assets/resources/{{$_GET.file}} but the route didn’t work.

First, in your server action create a get variable:

Use it in the download path:

Screenshot_6

The route that will be generated will include this get var as a parameter:

On the page, when you pick the route for the anchor button/link - just bind the value from your repeat using the dynamic data button:

Alright. I’ve followed the step without success. What I might have missed?


Annotation%202019-09-12%20150707

Annotation%202019-09-12%20145754
Annotation%202019-09-12%20150301
Annotation%202019-09-12%20150417

You need to use dynamic attributes - link, not a regular static href.

The link looks alright, but download doesn’t work. Just page flashing.


Annotation%202019-09-12%20151028

Please provide a link to your page, where i can check this.

@Teodor I’m not able to up the site at this moment. But just to make sure if this step also works with content / include routing page as in this case. Thanks.

I don’t see why it would not run … you can test it on a normal page to see also, but without a link to the page i can’t say what could be wrong.

Hi @Teodor I can confirm the method does work with routing page as well. I’ve tested on a fresh new page. It only problematic on the current page I work with. Once I’ve upped the page, would send the link to you to check. Thank you.

So just want to share, I’ve successfully diagnosed the problem. The reason the link didn’t work because it’s being called from a routing page inside routing with name i.e /insider/resource instead of just /resource. The solution is just by adding initial ../ to the link so it will omit /insider/ from the path. Mystery solved. :sweat_smile:

Annotation%202019-09-12%20225846