0

Possible Duplicate:
Detect when browser receives file download

I`m making in PHP a excel archive, but i need to know when the download of that arhive is complete to redirect the user to another page??

Can i do it? in PHP, Javascript??

Thanks for the help!

Community
  • 1
  • 1
Rodrigo López
  • 227
  • 4
  • 17
  • See http://stackoverflow.com/questions/1106377/detect-when-browser-receives-file-download for a similar question. – JW. Nov 01 '12 at 17:25
  • You can know when you've finished sending the file, but there is no way to tell when the client has finished recieving it (in PHP). – Asad Saeeduddin Nov 01 '12 at 17:25
  • How are you having the user download the file? – dpk2442 Nov 01 '12 at 17:26
  • @JW.: Those answers provide a way for a page to detect when a file download *begins*, not when it finishes. – josh3736 Nov 01 '12 at 17:31
  • I think that's the best you can do. It should be good enough, since the file can continue downloading after you redirect to another page. – JW. Nov 01 '12 at 17:53

1 Answers1

0

I have done this many times by making the target of my form submit an hidden iframe. The target PHP page will do the upload and then I do a PHP echo to write a Javascript block that will call a javascript function on the parent page. This parent function can do your redirect.

I usually display a modal progress bar on the parent page while its waiting for the child page to call the redirect function.

David Kinkead
  • 191
  • 1
  • 5