From 35bd39861f2f8e2ba83550f9a45e9ef7a9b9d6e5 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 4 Dec 2006 13:18:17 +0000 Subject: undo 1562. Knut, sorry I have to undo your change because the original code is right and your change will cause BC break. --- framework/Web/THttpResponse.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'framework/Web/THttpResponse.php') 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); -- cgit v1.2.3