nyroFwk  0.2
helper/file.class.php
Go to the documentation of this file.
1 <?php
10 class helper_file extends object {
11 
19  public function valid(array $file, array $prm = array()) {
20  if (empty($file) || (isset($file['size']) && $file['size'] == 0))
21  return true;
22 
23  if ($this->cfg->maxsize && $file['size'] > $this->cfg->maxsize)
24  return sprintf($this->cfg->getInArray('validErrors', 'maxsize'), '%s', file::humanSize($this->cfg->maxsize, true));
25 
26  $type = $file['type'] != 'application/octet-stream' ? $file['type'] : file::getType($file['name']);
27  if (count($this->cfg->mime) > 0 && !in_array($type, $this->cfg->mime))
28  return $this->cfg->getInArray('validErrors', 'mime');
29 
30  return true;
31  }
32 
33 }
static humanSize($file, $sizeGiven=false)
Definition: file.class.php:339
valid(array $file, array $prm=array())
static getType($file)
Definition: file.class.php:413
Generated on Sun Oct 15 2017 22:25:20 for nyroFwk by doxygen 1.8.13