diff options
author | xue <> | 2006-12-04 13:18:17 +0000 |
---|---|---|
committer | xue <> | 2006-12-04 13:18:17 +0000 |
commit | 35bd39861f2f8e2ba83550f9a45e9ef7a9b9d6e5 (patch) | |
tree | 78ad403c55bd60acd03988f799b8fe1ce004b01b | |
parent | 07edf7e8f1aa230d2da2a41db1b0c718ccc53bc9 (diff) |
undo 1562. Knut, sorry I have to undo your change because the original code is right and your change will cause BC break.
-rw-r--r-- | framework/Web/THttpResponse.php | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php index 45337add..a7a949f0 100644 --- a/framework/Web/THttpResponse.php +++ b/framework/Web/THttpResponse.php @@ -225,10 +225,9 @@ class THttpResponse extends TModule implements ITextWriter * @param string content to be set. If null, the content will be read from the server file pointed to by $fileName.
* @param string mime type of the content.
* @param array list of headers to be sent
- * @param string alternative file name used in attachment disposition
* @throws TInvalidDataValueException if the file cannot be found
*/
- public function writeFile($fileName,$content=null,$mimeType=null,$headers=null,$displayName=null)
+ public function writeFile($fileName,$content=null,$mimeType=null,$headers=null)
{
static $defaultMimeTypes=array(
'css'=>'text/css',
@@ -252,6 +251,7 @@ class THttpResponse extends TModule implements ITextWriter $mimeType=$defaultMimeTypes[$ext];
}
}
+ $fn=basename($fileName);
if(is_array($headers))
{
foreach($headers as $h)
@@ -265,10 +265,7 @@ class THttpResponse extends TModule implements ITextWriter }
header("Content-type: $mimeType");
header('Content-Length: '.($content===null?filesize($fileName):strlen($content)));
- if($displayName === null) {
- $displayName = basename($fileName);
- }
- header("Content-Disposition: attachment; filename=\"$displayName\"");
+ header("Content-Disposition: attachment; filename=\"$fn\"");
header('Content-Transfer-Encoding: binary');
if($content===null)
readfile($fileName);
|