blob: bdb2af6c32a00628c555f10b7bde2c869fddc176 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?php
trait SafeFileUploadMethods {
protected $_isSecure = TRUE;
public function getIsSecure() {
return $this->_isSecure;
}
public function setIsSecure($bool) {
$this->_isSecure = $bool;
}
public function getFileType() {
if ($this->getIsSecure()) {
$fileInfo = new finfo(FILEINFO_MIME_TYPE);
return $fileInfo->file($this->getLocalName());
}
return parent::getFileType();
}
public function getFileSize() {
if ($this->getIsSecure()) {
return filesize($this->getLocalName());
}
return parent::getFileSize();
}
}
?>
|