Changeset 1562 for branches/3.0

Show
Ignore:
Timestamp:
12/04/2006 07:00:52 AM (2 years ago)
Author:
knut
Message:

fixed #478

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/3.0/framework/Web/THttpResponse.php

    r1508 r1562  
    226226         * @param string mime type of the content. 
    227227         * @param array list of headers to be sent 
     228         * @param string alternative file name used in attachment disposition 
    228229         * @throws TInvalidDataValueException if the file cannot be found 
    229230         */ 
    230         public function writeFile($fileName,$content=null,$mimeType=null,$headers=null) 
     231        public function writeFile($fileName,$content=null,$mimeType=null,$headers=null,$displayName=null) 
    231232        { 
    232233                static $defaultMimeTypes=array( 
     
    252253                        } 
    253254                } 
    254                 $fn=basename($fileName); 
    255255                if(is_array($headers)) 
    256256                { 
     
    266266                header("Content-type: $mimeType"); 
    267267                header('Content-Length: '.($content===null?filesize($fileName):strlen($content))); 
    268                 header("Content-Disposition: attachment; filename=\"$fn\""); 
     268                if($displayName === null) { 
     269                  $displayName = basename($fileName); 
     270                } 
     271                header("Content-Disposition: attachment; filename=\"$displayName\""); 
    269272                header('Content-Transfer-Encoding: binary'); 
    270273                if($content===null)