Re: Raise a "File Download" Dialog Box for the XML MIME Type under IE 5

From: Date: Mon, 31 Jul 2000 15:07:10 +0000
Subject: Re: Raise a "File Download" Dialog Box for the XML MIME Type under IE 5
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-9172@lists.php.net to get a copy of this message
To get file downloads to work under IE and Netscape, there is basically only one consistent method. It's a kludgy way to do it, but it works. Set the content-type header to be 'application/octet-stream' Instead of invoking the script using myscript.php?filename=file try this myscript.php/file Inside of your script, use the $PATH_INFO variable to get the filename from the URL. Then you can do a readfile( $PATH_INFO ) or something similar. If you have any more questions regarding how to make this work consistently and in a more or less secure fashion, just email me. Chris dbourdon@dbourdon.com ("Denis Bourdon") wrote:
Hello! I'd like to raise a "File Download" dialog box to download an XML document created dynamically with PHP. So I put in this script: header("Content-disposition: filename=file.xml"); header("Content-type: text/XML"); header("Pragma: no-cache"); header("Expires: 0"); Actually, it doesn't raise any dialog box under IE 5 and 5.5, whereas it works under Netscape 4.7. Actually, as IE 5+ is an XML parser, XML is a known MIME type for him, and so it browses the file. So I try to declare it as an attachment to force the raise of the "File Download" Dialog Box: header("Content-disposition: attachment; filename=file.xml"); header("Content-type: text/XML"); header("Pragma: no-cache"); header("Expires: 0"); with 'attachment' in the Content-type: under IE it raises a dialog box but it wants to download it as "myscript.php" instead of "file.xml", which is quite strange because it does fit to the HTTP reference... Then I try to change and even delete the Content-type but it didn't work either. As IE 5+ has an XML parser, I'd like this to work under IE. Thanks for help! Den. PS: does someone know the accurate MIME-type for XML: is it "text/XML" or "application/XML"? I found nothing in the REC-xml-19980210. Thanks! -- Denis Bourdon - dbourdon@dbourdon.com Etudiant à Telecom Grenoble ENSIMAG/ENSERG site personnel: www.dbourdon.com webmaster de l'espace étudiants de Telecom Grenoble: www-telecoms.imag.fr/etudiants -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.general (#9172) next »