Meteor-files: How to give a custom name to a file download?

Created on 3 Dec 2017  路  8Comments  路  Source: veliovgroup/Meteor-Files

I want to set the file name on the fly once a download is triggered.

However, the naming function seems to be only relevant for the name the file is stored under.

Is this possible by any chance?

.serve() question

Most helpful comment

Hello @Mklueh ,

There is two ways (or both) to accomplish this:

To use download attribute simply add it to links in a template:

<a href="{{file.link}}" download="filename.ext">Download file</a>

To use Content-Disposition header, read this article

All 8 comments

Hello @Mklueh ,

There is two ways (or both) to accomplish this:

To use download attribute simply add it to links in a template:

<a href="{{file.link}}" download="filename.ext">Download file</a>

To use Content-Disposition header, read this article

@dr-dimitru wow I didn麓t know this was possible through HTML directly, thank you very much!

@Mklueh I'm this one is solved :)

Please, support this project by:

@dr-dimitru Tried it now, download tag doesn麓t do anything and keeps the FileCollection name. Trying Content-Disposition now

Feel free to reopen it in case if the issue still persists on your end.

  1. What browser you're on?
  2. This feature isn't supported only on few browsers - https://caniuse.com/#feat=download

I麓m using the latest version of Chrome, which should be supported according to that list. Weird

@Mklueh Share how you're using it, your code + chrome devtools screenshot, mb you have a typo somewhere

Feel free to reopen it in case if the issue still persists on your end.

Was this page helpful?
0 / 5 - 0 ratings