Re: Download file

From: Date: Mon, 25 Nov 2002 13:30:34 +0000
Subject: Re: Download file
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-17112@lists.php.net to get a copy of this message
Answering to myself: "Radovan Radic" <rasho@ving.co.yu> wrote in message news:20021125105726.77885.qmail@pb1.pair.com... > Hi > > I have problems with downloading files from my web application in php. > Here is the code from download.php > > <? > if (isset($dload)) > { > if ($dload=="cdrs") // > { > $filename="./dload_files/temp.txt"; add line: $file=basename($filename); > // now create file, and load some data from mssql in it - it is ok > $fp=fopen($filename,"w"); > write_data($fp); > fclose($fp); > } > $len=filesize($filename); > header('Cache-Control: no-cache, must-revalidate'); > header('Pragma: no-cache'); > header("Content-type: application/download"); > header("Content-Length: $len"); > header("Content-Disposition: attachment; filename=\"$filename\""); replace this line header("Content-Disposition: attachment; filename=\"$file\""); > $fp=fopen($filename, "r"); > fpassthru($fp); > exit; > } > ?> > > download.php is called from another page > I get the save as dialog box , but filename is not temp.txt but download > with no extension. I have heard this is bug in IE about content-disposition > headers. > Anyone can help here? > > Radovan > >

« previous php.windows (#17112) next »