javascriptfine-uploader

Fine uploader, idiomatic way to add download button to each file uploaded


I've successfully implemented fine uploader into my project. I'm using the addInitialFiles method to populate it with previously uploaded files.

What I would like to do is add a download button to each file preview rendered, both as a user add's files and 'on load' when prepopulated using addInitialFiles. Adding the button to the mark up template is pretty trival, but I'm stuck on what the most idiomatic way would be to:

I'm storing the files download url in a mongo collection that that im returning and populating the addInitial files method with.

In case it comes up: I'm not looking to have fine uploader 'handle' the download, I'm simply trying to weave the download functionality into it's UI :)

Appreciate any/all advice/pointers!


Solution

    1. Add an anchor link to your template somewhere inside the <li>.
    2. Listen for qq.status.UPLOAD_SUCCESS status changes.
    3. On success, update the anchor link to point to the appropriate download endpoint. You can find the anchor link for a specific file using getItemByFileId.

    You'll need to be sure your server returns the proper Content-Disposition header when responding to a download GET request.