uptick/react-keyed-file-browser

Download files

Closed this issue · 5 comments

Hi,

am I just really stupid or do I miss the option to download files? I can see there is a function there, but I cannot seem to find a way to get the link displayed.

Hi @cornelast ,
Please make use of the onDownloadFile prop. That function is passed to the onClick handler for the Download button in the default actionRenderer.

If you've overwritten the actionRenderer, then you should be able to implement your own download button in your custom actionRenderer that you passed in as a prop.

Yeah, working great, thanks.

Hi,

I am trying to use the package but failed to implement the download function. Would you provide a simple example of how to do this? I've read through the issues but still couldn't figure it out. Thank you so much!

@RebeccaWang0221

You can use the props as demonstrated in the code snippet below. Let me know if you have any issues.

<FileBrowser 
  files={myArrayOfFiles}
  onDownloadFile={arrayOfSelectedItems => { console.log('downloadFile', arrayOfSelectedItems) }}
  onDownloadFolder={arrayOfSelectedFolders => { console.log('downloadFolder', arrayOfSelectedFolders) }}
/>

@scaredcat Thank you so much for your reply and help! The code is working now.