How do Download a File with code?

I created a File.txt with the code of php, his which is saving in the server in the folder of aplication, but I need download the file after a determinate event

Somebody can help me…I need the solution or ideas for solution

you can solve this in many ways. The easy way is to make a custom php page which you call with a parameter, on which you simply place the download link of the file.
Check out: http://stackoverflow.com/questions/7263923/how-to-force-file-download-with-php
That should give you some ideas. Alternatively you can make a blank or a control application to do that (I would choose a control application).