Forum OpenACS Q&A: Response to Creation and removal of on-the-fly created download files

An inefficient but easy way to do it is to delete the file when the connection closes. The code in your tcl page would look something like:
ns_atclose "ns_unlink -nocomplain $tmpfile"
See http://aolserver.com/docs/devel/tcl/tcl-api.adp#ns_atclose for more information on that function. Hope that helps.