Similar to the uploading feature in fuelphp (link provided below), is there a tutorial for downloading files in fuelphp. There is not much information out there for fuelphp (other than the docs). Would I require a separate config page called download.php similar to upload.php?
All I really need is a page with either a download link or button to export csv to a user's local machine
Link to Upload feature
https://www.tutorialspoint.com/fuelphp/fuelphp_file_uploading.htm
Thanks in advance
Have you looked at the
Fileclass? This has a method ofdownloadwhich you pass thepathof the file to. The 2nd param allows you to specify the name of the file that's downloaded.If you want to restrict downloads per user, you'll need to add logic around that.
https://fuelphp.com/docs/classes/file/usage.html#/method_download
Example
Create a new controller, as you've pointed out,
download.php, and use the following as a starting point.You'll need to pass something through to the
get_indexin order to determine which file the client will download. I'd suggest some sort of look up, using an unique identifier, instead of a file path, otherwise this would easily be exploited.