protected function serve($file_info) { $cache = new sfFileCache(array('cache_dir' => sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . 'cache')); if ($file_info->getIsCached() && $cache->has($file_info->getId(), 'uploaded_files')) { $file_data = new FileData(); $file_data->setBinaryData($cache->get($file_info->getId(), 'uploaded_files')); } else { $file_data = $file_info->getFileData(); $cache->set($file_info->getId(), 'uploaded_files', fread($file_data->getBinaryData(), $file_info->getSize())); $file_info->setIsCached(true); $file_info->save(); } sfConfig::set('sf_web_debug', false); // $this->getResponse()->addHttpMeta('content-type', $file_info->getMime()); // $this->getResponse()->addHttpMeta('content-length', $file_info->getSize()); return $file_data; }