[HELP] File Download Problem

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
s00263668
Forum Newbie
Posts: 6
Joined: Tue Jul 18, 2006 9:48 pm

[HELP] File Download Problem

Post by s00263668 »

Hi all,

Currently i'm create a function to produce excel snapshots. When user click on the link, system will browse Page A. Meanwhile, page A will open a download dialog box and close itself automatically after user start download the file.

In practical, page A doesn't close after user start to download the file. Is there any way to solve this problem?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

you can't force a window to close after the download dialogue box is closed or the download has started.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

couldn't you close it with javascript?

window.close()
s00263668
Forum Newbie
Posts: 6
Joined: Tue Jul 18, 2006 9:48 pm

Post by s00263668 »

the problem was solve by using function of header.

Code: Select all

header("Content-type: application/vnd.ms-excel");
	header("Content-Disposition: attachment; filename=$filename" );
	header("Expires: 0");
	header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
	header("Pragma: public");
this code was copied from other people. but i wonder whether META function can provide the same effect?
Post Reply