diff options
author | emkael <emkael@tlen.pl> | 2016-04-25 11:32:37 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-04-25 11:32:37 +0200 |
commit | dd5aaa4db1e8758652586aa82f21bf631ce20bcc (patch) | |
tree | b694eb3820963769f34a3deca560ccde32279c35 /app/php/components/SafeFileUpload.php | |
parent | e6436897acd2c9f95e02ac9af0287791453b80f4 (diff) |
* safer getFileSize for T*FileUpload components
Diffstat (limited to 'app/php/components/SafeFileUpload.php')
-rw-r--r-- | app/php/components/SafeFileUpload.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/php/components/SafeFileUpload.php b/app/php/components/SafeFileUpload.php index 98e120a..ea65d22 100644 --- a/app/php/components/SafeFileUpload.php +++ b/app/php/components/SafeFileUpload.php @@ -19,14 +19,18 @@ trait MimeTypeCheckForFileUpload { } public function getFileType() { - $type = parent::getFileType(); if ($this->getIsSecure()) { $fileInfo = new finfo(FILEINFO_MIME_TYPE); return $fileInfo->file($this->getLocalName()); } - else { - return $type; + return parent::getFileType(); + } + + public function getFileSize() { + if ($this->getIsSecure()) { + return filesize($this->getLocalName()); } + return parent::getFileSize(); } } |