git-svn-id: http://xe-core.googlecode.com/svn/trunk@837 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-03-30 12:50:51 +00:00
parent d94dc0d9a8
commit d4880e4b96
2 changed files with 48 additions and 62 deletions

View file

@ -28,7 +28,7 @@
* @brief 다운로드 경로를 구함
**/
function getDownloadUrl($file_srl, $sid) {
return "./?module=file&act=procDownload&file_srl=".$file_srl."&sid=".$sid;
return "./?module=file&act=procFileDownload&file_srl=".$file_srl."&sid=".$sid;
}
/**
@ -125,48 +125,5 @@
return $output;
}
/**
* @brief 파일 출력
* 이미지나 멀티미디어등이 아닌 download를 받을 사용하는 method
**/
function procFileDownload() {
$file_srl = Context::get('file_srl');
$sid = Context::get('sid');
// 파일의 정보를 DB에서 받아옴
$file_obj = $this->getFile($file_srl);
if($file_obj->file_srl!=$file_srl||$file_obj->sid!=$sid) exit();
// 이상이 없으면 download_count 증가
$args->file_srl = $file_srl;
$oDB = &DB::getInstance();
$oDB->executeQuery('file.updateFileDownloadCount', $args);
// 파일 출력
$filename = $file_obj->source_filename;
if(strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
$filename = urlencode($filename);
$filename = preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1);
}
$uploaded_filename = $file_obj->uploaded_filename;
if(!file_exists($uploaded_filename)) exit();
$fp = fopen($uploaded_filename, 'rb');
if(!$fp) exit();
header("Cache-Control: ");
header("Pragma: ");
header("Content-Type: application/octet-stream");
header("Content-Length: " .(string)($file_obj->file_size));
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary\n");
fpassthru($fp);
exit();
}
}
?>