1

I am using a PHP header for downloading a JAR file and APK files in mobile. I can download the files successfully, but I want to show a popup when the download reaches 100%. How do I achieve this?

Is there any callback method for the download complete event?

header('Content-Type: '.$mime);
header('Content-Length: '.$stat['size']);
header('Connection: close');
header('Content-disposition: attachment; filename='.$file_name);
readfile($path_to_file);
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
shajahan
  • 11
  • 1
  • i dont think there is, you should call your function right when the download start. – Ibu Aug 13 '12 at 16:47
  • After `readfile`, update a database or some other data store with a piece of data showing the download for that user has completed. In your jQuery, poll some URL that checks for this data existing in the database. When it's there, the download is finished, so your jQuery callback can display the popup. – Dan Grossman Aug 13 '12 at 16:47

1 Answers1

0

There's no 'download finished' event. But you can use a workaround:

http://geekswithblogs.net/GruffCode/archive/2010/10/28/detecting-the-file-download-dialog-in-the-browser.aspx

See Detect when browser receives file download

Community
  • 1
  • 1
chris
  • 1,245
  • 1
  • 10
  • 22