note 48034 deleted from function.readfile by tomsommer
| From: | tomsommer@php.net | Date: | Thu, 09 Dec 2004 17:13:46 +0000 |
| Subject: | note 48034 deleted from function.readfile by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-81600@lists.php.net to get a copy of this message | ||
Note Submitter: accounts2 at stillpointsoftware dot com
----
I was having trouble getting Mozilla to correctly handle filenames containing spaces (e.g. "my
great file.doc") until I placed quotation marks around the filename in the header. Double
quotes were required; single quotes were interpreted as part of the file name. IE's processing
was not harmed by the double quotes.
<?php
header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header ("Content-Type: application/octet-stream");
header ("Content-Length: " . filesize($theFile));
header ("Content-Disposition: attachment; filename=\"$theFileName\"");
readfile($theFile);
?>