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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.