Re: IE can't download, FF can: SSL ? Need special headers?
| From: | Michael A. Peters | Date: | Fri, 29 May 2009 00:30:40 +0000 |
| Subject: | Re: IE can't download, FF can: SSL ? Need special headers? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-293335@lists.php.net to get a copy of this message | ||
Dee Ayy wrote:
Andrea and Ashley, Thanks ladies. Originally, IE claimed that the server wasn't even there (with that wacky IE error). I was lacking headers (which was fine for 6 years prior). The code below is consistent across the 3 browsers I tried (Safari, FF, IE). However, it converts spaces to underscores. I'm keeping this code: header('Content-Description: File Transfer'); header('Content-Type: '.$type); header('Content-Disposition: attachment; filename='.basename(str_replace(' ', '_', $name))); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: '.$size); echo $data; If I use header('Content-Disposition: attachment; filename="'.basename($name).'"'); of the 3 browsers tested, only IE will replace spaces with underscores. Safari and FF pass through correctly. But I'll go with consistency and avoid the "if browser-war" clauses. Thanks all.This is what I'm doing: header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header('Content-type: application/gpx+xml'); header("Content-Disposition: attachment; filename=\"Records.gpx\""); header("Content-Transfer-Encoding: binary"); print $myxml->saveXML(); -=- Looks very similar to yours, but I haven't tested in IE or Safari. I got the headers to send from some php cookbook website. Technically the mime type I'm sending in my case isn't valid (there is not an official gpx mime type), but it works and allows association with a helper application specific to gpx files.