function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Phuc 2Phuc 2 

aura component download file then open it

Hello All,
I have a SF Site with an aura component where I need the user to be able to click a link which downloads the file and then opens it.  I have the file.  I can either use it as a static resource or upload it to SF and use the link from the file.  Right now when the use clicks the link it just opens the file.  You then need to download the file and manually open the downloaded file. Is there a way to download the file on click and have it open after download?
Thank you,
P
McCuboMcCubo
Hi Phuc,
I think you can achieve your goal by adding the download attribute to the anchor tag
<a href="{!filename}" download>Click Here</a>

that attribute forces a file download dialog box to appear when the link to the file is clicked, then the user can manually go to their downloads folder and open the file.
Shana G 9Shana G 9
I'm having the same requirement.
I using the download attribute is not working on my Aura page
@ Phuc 2
Were you able to achieve it