I have the following code:
header('Content-type: text/plain');
header("Content-Disposition: attachment; filename=bookmark.adr");
readfile('bookmark.adr');
This makes a save-as popup where an user can save the bookmark.adr file. But I would like to custom generate the content of that file. How can I generate the content and let that file be popupped as save-as?
Thanks!
Just don't do readfile()
. Echo out whatever you want that file to contain instead.
Your Content-Disposition
header is what will tell most browsers to prompt the user to save the file.