예제 #1
0
 /**
  * Process download a file
  *
  * @param string $file : Full path to the file which will be downloaded
  */
 public static function processDownload($filePath, $filename)
 {
     jimport('joomla.filesystem.file');
     $fsize = @filesize($filePath);
     $mod_date = date('r', filemtime($filePath));
     $cont_dis = 'attachment';
     $ext = JFile::getExt($filename);
     $mime = HelpdeskProHelper::getMimeType($ext);
     // required for IE, otherwise Content-disposition is ignored
     if (ini_get('zlib.output_compression')) {
         ini_set('zlib.output_compression', 'Off');
     }
     header("Pragma: public");
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     header("Expires: 0");
     header("Content-Transfer-Encoding: binary");
     header('Content-Disposition:' . $cont_dis . ';' . ' filename="' . $filename . '";' . ' modification-date="' . $mod_date . '";' . ' size=' . $fsize . ';');
     //RFC2183
     header("Content-Type: " . $mime);
     // MIME type
     header("Content-Length: " . $fsize);
     if (!ini_get('safe_mode')) {
         // set_time_limit doesn't work in safe mode
         @set_time_limit(0);
     }
     HelpdeskProHelper::readfile_chunked($filePath);
 }