Skip to content

Commit

Permalink
Get file size/name/type
Browse files Browse the repository at this point in the history
  • Loading branch information
voltan committed Apr 1, 2013
1 parent be9a322 commit 702ad83
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion lib/Pi/File/Transfer/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
}

0 comments on commit 702ad83

Please sign in to comment.