CI 묻고 답하기

제목 ie 브라우저에서 ppt, pdf 파일 다운로드 시 다운로드 중단 관련해 질문드립니다.
글쓴이 overback 작성시각 2014/11/06 18:38:21
댓글 : 1 추천 : 0 스크랩 : 0 조회수 : 16020   RSS
ie 브라우저에서 ppt, pdf 파일 다운로드 시 다운로드 중단 관련해 질문드립니다.
크롬에서는 정상적으로 다운로드가 되오나.. ie에서만 다운로드 중단이 발생되고 있습니다.


 function force_download($filename = '', $data = '' )
 {

  $filename = urldecode($filename);

  if ($filename == '' OR $data == '')
  {
   return FALSE;
  }

  // Try to determine if the filename includes a file extension.
  // We need it in order to set the MIME type
  if (FALSE === strpos($filename, '.'))
  {
   return FALSE;
  }

  // Grab the file extension
  $x = explode('.', $filename);
  $extension = end($x);

  // Load the mime types
  if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
  {
   include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
  }
  elseif (is_file(APPPATH.'config/mimes.php'))
  {
   include(APPPATH.'config/mimes.php');
  }

  // Set a default mime if we can't find it
  if ( ! isset($mimes[$extension]))
  {
   $mime = 'application/octet-stream';
  }
  else
  {
   $mime = (is_array($mimes[$extension])) ? $mimes[$extension][0] : $mimes[$extension];
  }

  if (isIE() === true) $filename = urlencode($filename);

  // header 구성
  header("Pragma: public");
  header("Expires: 0");
  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  header("Cache-Control: public");
  header("Content-Description: ".$_SERVER['HTTP_HOST']." Generated Data");
  header('Content-Type: "'.$mime.'"');
  header("Content-Disposition: attachment; filename=".$filename.";");
  header("Content-Transfer-Encoding: binary");
  header("Content-Length: ".strlen($data));

  exit($data);
 }
}
 다음글 데이터베이스 dsn 연결과 active_group 비활... (7)
 이전글 xml content-type 관련 질문 (3)

댓글

변종원(웅파) / 2014/11/07 10:35:19 / 추천 0
중단시 에러메시지나 서버상의 로그는요?

다른 컴퓨터의 ie에서도 동일한 현상이 발생되는지요?