showFile()
public function showFile() { //...your PHP code...// }
Allows you to generate a file for download using your module.
No context is provided automatically. You must provide any context yourself in the GET request.
From Zenario 7.0.0 onwards.
You should write a showFile()
method if you want your Plugin to generate files.
You should send appropriate headers, then output the contents of the file.
No return value is needed.
public function showRSS() { header('Content-Type: text/plain'); header('Content-Disposition: attachment; filename="mytextfile.txt"'); readfile("mytextfile.txt"); }
This offers a file called mytextfile.txt for download. (Note that this is just a simple example; you would probably want to store files in a database table to make showFile
useful.