File Downloads

From: Date: Fri, 20 Oct 2000 11:04:35 +0000
Subject: File Downloads
Groups: php.general 
Request: Send a blank email to php-general+get-21363@lists.php.net to get a copy of this message
Hi all, File downloads again. Via PHP I am sending the following http headers: header("Content-type: application/vnd.ms_excel"); header("Content-length: $filesize"); header("Content-disposition: attachment; filename=\"$sname\""); (where $filesize is the size of the entity and $sname is the suggested "save as ..." filename ) then I readfile($fname); return; where $fname is the full path to the file. This works well in Netscape 4.7 but not in IE4 (surprise, surprise) which has a problem with the filename; it suggests the URI (?) then if you accept that it goes off in a sulk and no file is downloaded. My file is a standard CSV; I want Netscape to offer me the save as dialog (as it does now) and IE to give me the File Download dialog box and offer the correct filename if I want to save it. If I just redirect to the CSV file, IE opens it in Excel (without File Download dialog) and Netscape treats is as text. (I cannot upgrade the browsers) Any ideas? TIA --Clive

« previous php.general (#21363) next »