diff --git a/modules/board/skins/default/view_document.html b/modules/board/skins/default/view_document.html index 4c74870b9..6d5920ab1 100644 --- a/modules/board/skins/default/view_document.html +++ b/modules/board/skins/default/view_document.html @@ -61,7 +61,7 @@ {$lang->uploaded_file} -
{$file->source_filename} ({FileHandler::filesize($file->file_size)}) ({number_format($file->download_count)})
+
{$file->source_filename} ({FileHandler::filesize($file->file_size)}) ({number_format($file->download_count)})
diff --git a/modules/editor/tpl/js/uploader.js b/modules/editor/tpl/js/uploader.js index 126d1e543..40a8987a0 100755 --- a/modules/editor/tpl/js/uploader.js +++ b/modules/editor/tpl/js/uploader.js @@ -193,7 +193,7 @@ function editor_insert_file(upload_target_srl) { while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; } var mid = fo_obj.mid.value; var upload_target_srl = fo_obj.upload_target_srl.value; - var url = "./?mid="+mid+"&act=procDownloadFile&upload_target_srl="+upload_target_srl+"&file_srl="+file_srl+"&sid="+sid; + var url = "./?module=file&act=procDownload&file_srl="+file_srl+"&sid="+sid; openComponent("url_link", upload_target_srl, url); } } diff --git a/modules/file/conf/module.xml b/modules/file/conf/module.xml index 9cd5a990b..b3320e25f 100644 --- a/modules/file/conf/module.xml +++ b/modules/file/conf/module.xml @@ -3,6 +3,7 @@ + diff --git a/modules/file/file.model.php b/modules/file/file.model.php index 4996b84ea..978459765 100644 --- a/modules/file/file.model.php +++ b/modules/file/file.model.php @@ -32,7 +32,15 @@ $args->file_srl = $file_srl; $output = $oDB->executeQuery('file.getFile', $args); - return $output->data; + if(!$output->toBool()) return $output; + + $file = $output->data; + $direct_download = $file->direct_download; + + if($direct_download=='Y') $file->download_url = $uploaded_filename; + else $file->download_url = "./?module=file&act=procDownload&file_srl=".$file->file_srl."&sid=".$file->sid; + + return $file; } /** @@ -51,12 +59,14 @@ for($i=0;$idirect_download; + + if($direct_download=='Y') { + $download_url = Context::getRequestUri().substr($file_list[$i]->uploaded_filename,2); + $file_list[$i]->download_url = $download_url; + } else { + $file_list[$i]->download_url = "./?module=file&act=procDownload&file_srl=".$file_list[$i]->file_srl."&sid=".$file_list[$i]->sid; + } - if($direct_download!='Y') continue; - - $uploaded_filename = Context::getRequestUri().substr($file_list[$i]->uploaded_filename,2); - - $file_list[$i]->uploaded_filename = $uploaded_filename; } return $file_list; } @@ -113,7 +123,10 @@ * @brief 파일 출력 * 이미지나 멀티미디어등이 아닌 download를 받을 때 사용하는 method **/ - function procDownload($file_srl, $sid) { + function procDownload() { + $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();