Re: How to open a save-as dialog and then redirect after donwload?

From: Date: Tue, 19 Aug 2003 10:04:54 +0000
Subject: Re: How to open a save-as dialog and then redirect after donwload?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-159996@lists.php.net to get a copy of this message
This is what you want (thanks go to Billy S Halsey): <?php header("Content-Type: multipart/mixed; boundary=\"-Boundary-12399\""); print "---Boundary-12399\r\n"; print "Content-Type: text/html\r\n"; print "\r\n"; // Your HTML code goes here print "\n"; print "---Boundary-12399\r\n"; print "Content-Type: application/octet-stream\r\n"; print "Content-Disposition: attachment; filename=foo.tar.gz\r\n\r\n"; readfile("./foo.tar.gz"); print "---Boundary-12399--\r\n"; print "\r\n"; ?> It sends html page first as download can take much longer. Jean-Christian IMbeault wrote:
I want to create the following: 1- A screen a series files and associated buttons 2- if the user clicks the button a "File | save as" dialog opens up 3- after the file the user is redirected to a new page I've gotten 1 and 2 to work but I can't figure out how to do anything after the file has finished downloading. I've tried header("Location: ") but that doesn't work because it must be used before any input is sent. The reason I want this functionality is that once a file is downloaded I want the screen with the buttons to refresh itself and remove the downloaded file from the list displayed to the user. How can I accomplish this? All suggestions welcomed! Jean-Christian Imbeault


« previous php.general (#159996) next »