The following should work:
Most click scripts will redirect to file. what u do instead is:-
instead of giving header("Location: [url]http://.../.../.../[/url] )"
pass the other header (just forget this, its has some 'attachement' text in it, plz search the forums ofr this, i am a bit busy right now, u will find this header here only, very common)
after open the file and start echoing its contents. after u have echoed all contents update the db
Note: if user cancels just when the download is almost complete