Page 1 of 1

How to detect if a user cancels a file download

Posted: Mon Sep 10, 2007 6:53 am
by leosuth
I hope this is the correct place, apologies if not! :D

I need code that will detect when a user clicks the Cancel or Save/Run buttons on the browser file download dialog so I can update my database appropriately - I'm running a queue in the database - when the file is downloaded, then it is removed from the queue, but if the user starts the file download but presses the Cancel
button, then it should not be removed from the queue.

My problem appears to be that the file gets downloaded regardless into the browser cache, and then the user decides wherether or not to use the - by whihc point the file has already been removed from the queue by my script - my script needs to wait until it finds out if the file has been selected to be downloadaed from the cache or not. :roll:

Or perhaps I need a way to check whether the file is in the cache or not:

start download
check as long as file is in cache until file is not in cache

this does assume that when a file is moved from the IE cache to the final destination that it gets removed from cache. It also will need a timeout - if it is still in the cache after a certain time, assume user has cancelled download.

Any help, suggestions and code :wink: will be muchly appreciated.

Posted: Mon Sep 10, 2007 7:16 am
by superdezign
Not sure if you can. Yo don't really have control over that from the server-side, and the client-side would be pretty limited as well as you don't have access to their file structure.

Maybe you could give them all of their downloads and allow them to manually remove files from their list after they've downloaded it. A complete download could have been corrupted during the download process anyway.