3

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?

Petteri H
  • 11,779
  • 12
  • 64
  • 94
  • @pepez: Once you got it working, please post an answer with some example sourcecode (feel free to accept it as the best answer ;-) – Treb Jun 27 '09 at 12:20

1 Answers1

2

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.

Community
  • 1
  • 1
Treb
  • 19,903
  • 7
  • 54
  • 87