Skip to content

Download Attachments via Link #11350

Answered by ConorWebb96
Brrrradley asked this question in Help
Discussion options

You must be logged in to vote

Hey @Brrrradley,

I think i've achieved what you are after with some minor JS plus the use of the repeater and embed component. Below is the component tree as well as the JS code used within the binding to achieve the desired effect.

Component tree

JS Code

const attachments = $("New Repeater block.test.attachments");

if(attachments) {
  let html = '';
    for (const attachment of attachments) {
      html += `<a href="${attachment.url}" download>${attachment.name}</a><br>`;
    }

  return html;
}
return 'No attachments here';

Output

I hope this makes sense and is helpful, if you have any questions around this let me know.

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
4 replies
@Brrrradley
Comment options

@melohagan
Comment options

@SaschaValentin
Comment options

Answer selected by ConorWebb96
Comment options

You must be logged in to vote
3 replies
@melohagan
Comment options

@spitoutzi
Comment options

@melohagan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment