Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set a custom filename #6

Open
jamieburchell opened this issue Sep 11, 2019 · 1 comment
Open

Unable to set a custom filename #6

jamieburchell opened this issue Sep 11, 2019 · 1 comment

Comments

@jamieburchell
Copy link

It would be good if we could set a custom filename rather than relying on the filename of the file being served. In my case, the file to be served has a filename of random characters but I'd like to serve the file with a "friendly" name.

@DaveRandom
Copy link
Owner

As it stands this can be done be implementing your own Resource, the bundled FileResource class does not enable you to do this but you could essentially copy/paste this and alter the getAdditionalHeaders() method to emit a different file name in the Content-Disposition header.

This library has been designed to be a "slim" framework and doesn't contain "extended" functionality like that, the possible variants of where data would be sourced (e.g. a database) and what meta-data might need to be included (e.g. Expires: headers) are too wide to reasonably include everything all in one without making a very messy and confusing API. Rather than shipping the kitchen sink, I prefer the approach of good IoC design and interfaces - extensible rather than configurable in other words :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants