I have a site that is downloading by using headers to hide the url from the person. I got it working and it downloads just fine. The problem I'm having is that when it downloads the browser goes to a blank screen and when I hit save on the file download window the browser gets an action canceled screen. The download goes fine but something is getting interrupted or something.
Here is my code:
$filename = "file.zip";
$path = "/dl/";
$filewithpath = $path . $filename;
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=".$filename);
readfile($filewithpath);
Is there anyway you can make it so that the browser stays at the page it's on when the download is going instead of going to a blank screen? Or have it redirect to a different page when the download is done?