views:

177

answers:

1

Let's say I have a Spring MVC web application and it allows users to download a file. An email is sent at the same time as the file is sent to the user.

Is there a way to detect cancelled download so I could send the email only if the download has been successful?

+2  A: 

You need a download script that serves larger files in seperate blocks. When the last block has been served, you can assume (there is no way to know with HTTP) that the complete file was received by the client.

Have a look at questions 157318 and 194579 on how to achieve this in PHP. Since you always use HTTP (or HTTPS) to serve the files, the same principles apply to your question.

Treb