It would not even be necessary to write the file to the server's filesystem.
The user clicks a link, which points to a PHP script. That script will send two HTTP headers: a "Content-type: text/plain" header and a "Content-Disposition: attachment; filename=thefile.csv" header then stream the file to the browser.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.