Need to provide a link to download files out of the file manager

Hi,

In our application, if a file is uploaded by a user, other users get alerts with file name and path in the alert. We have a "Click here"alerts.png link in alert and We would like to allow the user to download a file by clicking that. How can I link the download action of file to that button.


Thanks

Yamini


1 Reply

SM Shalini Maragathavel Syncfusion Team October 1, 2021 12:40 PM UTC


Hi Yamini, 

Greetings from Syncfusion support. 

Based on your query, we suspect that you need to perform download action of File Manager in an external button. You can achieve your requirement by using the downloadFiles method of File Manager as demonstrated in the below code snippet,  
App.component.html 

<button ejs-button (click)="downloadfile($event)" class="e-primary"> 
  Click here to down the selected file 
</button> 

<div class="sample-container"> 
  <ejs-filemanager #filemanager id="overview" [ajaxSettings]="ajaxSettings"> 
  </ejs-filemanager> 
</div> 

----------------------------------------------------------------------- 
App.component.ts 
 
export class AppComponent { 

  downloadfile(args) { 
    var selectedfiles = this.file.getSelectedFiles(); 
    if (selectedfiles.length > 0) { 
      this.file.downloadFiles(); 
    } 
  } 

In the sample, we have downloaded the selected files of File Manager in an external button click. Similarly, you can download the files according to your requirement.

Please find the below sample for your reference, 
Please get back to us if you need further assistance.

Regards, 
Shalini M. 


Loader.
Up arrow icon