thank you.But I still doesn`t understand what you say.
$file = sfConfig::get('sf_root_dir').'/[dir]/'.$filePath;
// [dir] is inaccessible from the web What do you mean by this?
On 6月8日, 下午6时03分, sfNico <[email protected]> wrote:
> Portable and a little bit simpler :
>
> protected function sendFile($response,$contentType,$filePath)
> {
> $response = $this->getResponse();
> $file = sfConfig::get('sf_root_dir').'/[dir]/'.$filePath; // [dir]
> is inaccessible from the web
>
> if(is_file($file))
> {
> $response->setHttpHeader('Content-Type', $contentType);
> $response->setHttpHeader('Content-Length', filesize($file));
> $response->setHttpHeader('Last-Modified', gmdate("D, d M Y H:i:s",
> filemtime($file)).' GMT');
> $response->sendHttpHeaders(); // send the headers before the file
> data
> $response->setContent(readfile($file));
> }
>
> return sfView::NONE;
>
>
>
> }- 隐藏被引用文字 -
>
> - 显示引用的文字 -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---