Jump to content

Help with an automatic download page


rossmurphy

Recommended Posts

I've created an automatic download page that uses this code to initiate the download:

 

header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($file));
header("Content-disposition: attachment; filename=".basename($file));
readfile("$file");
exit;

 

This works fine. The page that this code is on also has some text that alerts the user their download is starting soon. The problem is that this page seems like it never loads. The page with the download link should send the user to the next page with this code on it and it should display some text to the user but the page never changes. Although i do know it does reach the page because the download starts. But anything below the above code does not get displayed. Does anyone know what i can do to solve tis or know of any tutorials about downloading using php.

 

Cheers.

Link to comment
https://forums.phpfreaks.com/topic/85634-help-with-an-automatic-download-page/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.