Re: downloading files

From: Date: Fri, 09 Jun 2000 00:03:45 +0000
Subject: Re: downloading files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-1354@lists.php.net to get a copy of this message
Bill Rausch wrote: > > I've written the getfile.php script to get the file from the backend to the > web server machine, and then hand it to the browser using: > ... // get file from backend into tmp directory on web server > ... > header( "Location: http://hostname/tmp/$filename" ); > > The question I have is how can I control the downloaded file's name. > Instead of being named, for example, demo.ppt, it is saved by the client's > browser as getfile.php. > If you send a page with a meta refresh tag, most browsers should pick up the correct filename. This is, of course, quite annoying where the back button is concerned. You could also load up a page with a bit of JavaScript to do the same thing. Something like location.replace("http://newurl/"); This is off the top of my head, so I apologize if it isn't 100% accurate. Check out developer.netscape.com for the actual javascript docs. James

« previous php.general (#1354) next »