Open New page when downloading is on progress

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rabik
Forum Newbie
Posts: 4
Joined: Tue Apr 20, 2010 1:43 am

Open New page when downloading is on progress

Post by rabik »

Hi,
I have a script which prompts user to download a file. The code looks like this

header("Pragma: public");
header("Expires: 0"); // set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-length: ".filesize("$filepath));
header("Content-type: $mime");
header('Content-Transfer-Encoding: binary');
header('Content-Disposition: attachment; filename="'.$some_name.'"');
readfile($filename);
exit(0);

With this script download dialog box appears and we can download or save files from browser. But when the file is being download, the site hangs i.e. no other pages can be navigated. Site just stays on the similar page. If anyone has idea on this, please let me know.

Thank you
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Open New page when downloading is on progress

Post by Benjamin »

Have you confirmed the issue is not with the browser itself?
rabik
Forum Newbie
Posts: 4
Joined: Tue Apr 20, 2010 1:43 am

Re: Open New page when downloading is on progress

Post by rabik »

i have tried it with firefox, safari, chrome and IE6. It works fine with IE6. By the way how can i confirm it is the problem of browsers?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Open New page when downloading is on progress

Post by Benjamin »

rabik
Forum Newbie
Posts: 4
Joined: Tue Apr 20, 2010 1:43 am

Re: Open New page when downloading is on progress

Post by rabik »

i went through the link but could not find any clue for my problem. please help me to resolve the problem. I just the need to open all other pages of the website while download on my site is on progress
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Open New page when downloading is on progress

Post by Benjamin »

You'll need to read it again, carefully. It explains exactly what is happening.
rabik
Forum Newbie
Posts: 4
Joined: Tue Apr 20, 2010 1:43 am

Re: Open New page when downloading is on progress

Post by rabik »

Sorry but i could not get anything from that link. Please have a look at the code above, if there is any problem, let me know. And if there are any other issue besides code, suggest me what to do next
Post Reply