1

To download files dynamically on the same page, I added a iframe and I change its attribute src to with jquery to force a download without leaving the page or opening a new tab. It works great, but the only problem is to hook an event when the php file I'm refering to has finished its execution.

The only output the php page produce is the following :

header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=fichiers.zip");
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");

readfile($archive);

As mentionned, it works great and the file is downloading as expected. But the zip file is created dynamically using the ZipArchive class of php depending of the files the user wants. This process takes some time depending on the files size and a loading icon appears beside the cursor for few seconds the time the php page finish.

I want to hook an event to when the php file has finished its execution. I tried using the iframe.onload event, but it didn't work.

maniak
  • 442
  • 5
  • 22
  • This might be what you are looking for. http://stackoverflow.com/questions/1106377/detect-when-browser-receives-file-download – Jason Foglia Mar 14 '12 at 18:02

0 Answers0