diff --git a/lib/Pi/File/Transfer/Upload.php b/lib/Pi/File/Transfer/Upload.php index 0c7e97a966..1c3722f9b4 100644 --- a/lib/Pi/File/Transfer/Upload.php +++ b/lib/Pi/File/Transfer/Upload.php @@ -202,4 +202,51 @@ public function getUploaded($name = null, $path = false) } return $result; } -} + + /** + * Get file(s) info + * + * @return array + */ + public function getInfo() + { + $ret = array(); + $files = $this->getAdapter()->getFileList(); + foreach ($files as $key => $data) { + $ret['name'] = $data['name']; + $ret['size'] = $data['size']; + $ret['type'] = $data['type']; + } + return $ret; + } + + /** + * Get file size + * + * @return size number + */ + public function getSize() + { + return $this->getInfo()['size']; + } + + /** + * Get file name + * + * @return file name + */ + public function getName() + { + return $this->getInfo()['name']; + } + + /** + * Get file Type + * + * @return file Type + */ + public function getType() + { + return $this->getInfo()['type']; + } +} \ No newline at end of file