public function getFiles($dirname = '') { $arr_folder = array(); $count = 0; $folder = UPLOAD_DIR; $folder .= DIRECTORY_SEPARATOR . $dirname; if (is_dir($folder)) { $dir = new RecursiveDirectoryIterator($folder); $iter = new RecursiveIteratorIterator($dir, RecursiveIteratorIterator::SELF_FIRST); while ($iter->valid()) { if (!$iter->isDot()) { if ($iter->getDepth() < $this->maxDepth) { $item = array(); $item['id'] = $count; $item['size'] = $iter->getSize(); $item['type'] = $iter->getType(); $item['ext'] = $iter->getExtension(); $item['pathname'] = $iter->getSubPathName(); $item['filename'] = $iter->getFilename(); $item['parent'] = '/' . $dirname; $item['Exec'] = $iter->isExecutable(); $item['sub'] = ''; $count++; $arr_folder[] = $item; } } $iter->next(); } return $arr_folder; } if (is_file($folder)) { $file = file_get_contents($folder); if (empty($file)) { return ' '; } return $file; } }