<?php global $mainframe, $fmanager, $my;if ( isset($_FILES['docmanfile']) && is_array($_FILES['docmanfile'])) { $file = $_FILES['docmanfile']; $name = preg_replace("/[\s]/", "_", eUTF::utf8_strtolower($file['name'])); $lowfilename = $my->id.'_'.$name; $uploaddir = $mainframe->getCfg('absolute_path').'/docmanfiles'; $ext = $fmanager->FileExt($lowfilename); $valid_exts = array('zip', 'rar', 'tar', 'gz'); if (in_array($ext, $valid_exts)) { if (file_exists($uploaddir.'/'.$lowfilename)) { $lowfilename = $my->id.'_'.time().'.'.$ext; } if ($fmanager->upload( $file['tmp_name'], $uploaddir.'/'.$lowfilename )) { $fmanager->spChmod( $uploaddir.'/'.$lowfilename, '0666' ); } }}?>
<?php global $fmanager, $my, $mainframe;$userFiles = array(); //array of user submitted files$allFiles = $fmanager->listFiles( $mainframe->getCfg('absolute_path').'/docmanfiles' );foreach ( $allFiles as $file ) { if (eregi( "\.(tar|zip|gz|rar)$", $file )) { if (ereg("^".$my->id."_", $file)) { $userFiles[] = $file; } }}?>