Download On-The-Fly module provides service to download files.
Files are created and downloaded dynamically without saving it to the server.
It supports all file extension whose generated data can be casted to a string.
Example file extensions csv, ics, pdf, txt, xls, xlsx etc.
Here we configure each file extension along with supporting HTTP Headers to support downloading them On-The-Fly.
External libraries can also be used for the generation of file data.
How to use?
You can make downloadables available On-The-Fly for the end users, by simply calling 'download_otf.download' service function from any of your custom route.
Take a case, when you want to export your site data in an xls file.
- Install and enable this module
- Configure and manage file-headers for xls file here /admin/config/download_otf/settings, example:
- Content-Type: application/vnd.ms-excel; charset=utf-8
- Cache-control: no-cache
- Put this code in any of your custom route:
$data = "Item, Price\n";
$data .= "Item1, ₹21\n";
$data .= "Item1, ₹551\n";
\Drupal::service('download_otf.download')->download($data, 'xls');
Please find working examples here.
Also, please go through README.txt for examples, usage, guidelines etc.
Project information
- Project categories: Media
2 sites report using this module
- Created by abhaysaraf on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.



