My script currently creates a text file and then sends the text file to the user as an attachemnt.
The code:
header("Content-Length: ".filesize($file_path));
header("Content-Disposition: attachment; filename=".$file_path);
This works fine but I'd rather have the user download a file called myfile.txt that is really just the contents of a variable.
Any ideas how to do this?