1

Is there a way to detect when user download the whole file? I'm using this script for downloading ZIP file:

header($_SERVER['SERVER_PROTOCOL'] . ' 200 OK');
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: Binary");
header("Content-Length: " . filesize($filePath));
header("Content-Disposition: attachment; filename=\"" .$fileName . "\"");

I read some advice but no one works. Please if you have WORKING and TESTED solution I'll be glad.

Thanks

quarky
  • 710
  • 2
  • 13
  • 36
  • 1
    Have a look here: http://stackoverflow.com/questions/1106377/detect-when-browser-receives-file-download Possibly a duplicate of this http://stackoverflow.com/questions/1563187/check-if-download-is-completed as well. – Jonathan May 21 '15 at 22:47

1 Answers1

0

You can also check every n seconds if the file exists:

file_put_contents("folder/file", fopen(file_url, 'r'));
while(!file_exists('folder/file')){
   sleep (5);
}

//Do your stuff with the downloaded file 
Denis
  • 170
  • 1
  • 9