summaryrefslogtreecommitdiff
path: root/framework/Web/THttpResponse.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/THttpResponse.php')
-rw-r--r--framework/Web/THttpResponse.php9
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);