Hi all,
I'm needing a text file to download to the client that is generated as a php file. Thing is the browser wants to open it and when you use right click save as it wants to add the .php ending to it. I need this supper simple for a user to use is there any type of header I can use that will make this download as a simple .txt.
Or can I some how add this to a attachment and send it via email? All the examples I've seen are for attaching binary information and not simple text.
Downloading a text file
Moderator: General Moderators
-
php_wiz_kid
- Forum Contributor
- Posts: 181
- Joined: Tue Jun 24, 2003 7:33 pm
You can use the Content-Disposition header to supply a recommended filename and force the browser to display the save dialog.
Code: Select all
header('Content-Disposition: attachment; filename="downloaded.txt"');