From c9961fa9266b5df96cb4b0ba166830eb6d700b49 Mon Sep 17 00:00:00 2001 From: bnu Date: Mon, 22 Dec 2014 15:33:13 +0900 Subject: [PATCH] =?UTF-8?q?fix=20#1104=20=ED=97=88=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EC=9D=80=20=ED=99=95=EC=9E=A5=EC=9E=90?= =?UTF-8?q?=EC=9D=98=20=ED=8C=8C=EC=9D=BC=EC=9D=84=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=ED=95=A0=20=EC=88=98=20=EC=9E=88=EB=8A=94=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=EA=B3=A0=EC=B9=A8=20-=20=EB=B3=B4=EA=B3=A0?= =?UTF-8?q?=EC=9E=90=20:=20=EA=B5=AD=EC=A0=9C=EC=A0=95=EB=B3=B4=EB=B3=B4?= =?UTF-8?q?=EC=95=88=EA=B5=90=EC=9C=A1=EC=84=A0=ED=84=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/file/file.controller.php | 19 +++++++++++++++++++ modules/file/lang/lang.xml | 3 +++ 2 files changed, 22 insertions(+) diff --git a/modules/file/file.controller.php b/modules/file/file.controller.php index 32f8705a9..377a2a569 100644 --- a/modules/file/file.controller.php +++ b/modules/file/file.controller.php @@ -626,6 +626,25 @@ class fileController extends file { $oFileModel = getModel('file'); $config = $oFileModel->getFileConfig($module_srl); + + // check file type + if(isset($config->allowed_filetypes) && $config->allowed_filetypes !== '*.*') + { + $filetypes = explode(';', $config->allowed_filetypes); + $ext = array(); + foreach($filetypes as $item) { + $item = explode('.', $item); + $ext[] = $item[1]; + } + $uploaded_ext = explode('.', $file_info['name']); + $uploaded_ext = array_pop($uploaded_ext); + + if(!in_array($uploaded_ext, $ext)) + { + return $this->stop('msg_not_allowed_filetype'); + } + } + $allowed_filesize = $config->allowed_filesize * 1024 * 1024; $allowed_attach_size = $config->allowed_attach_size * 1024 * 1024; // An error appears if file size exceeds a limit diff --git a/modules/file/lang/lang.xml b/modules/file/lang/lang.xml index d54630c7e..22d31a265 100644 --- a/modules/file/lang/lang.xml +++ b/modules/file/lang/lang.xml @@ -331,6 +331,9 @@ + + +