Пример #1
0
 /**
  * prepare multiple files for upload
  *
  * @param array $coda $_FLES['userfile']
  *
  * @return call uploadFIle()
  */
 public function uploadMulti($coda)
 {
     global $location;
     if ($location->editAllowed() && GateKeeper::isUserLoggedIn() && GateKeeper::isAccessAllowed() && GateKeeper::isAllowed('upload_enable')) {
         // Number of files to uploaded
         $num_files = count($coda['tmp_name']);
         $totnames = array();
         /** loop through the array of files ***/
         for ($i = 0; $i < $num_files; $i++) {
             $filepathinfo = Utils::mbPathinfo($coda['name'][$i]);
             $filename = $filepathinfo['filename'];
             $filex = $filepathinfo['extension'];
             $thename = $filepathinfo['basename'];
             $tempname = $coda['tmp_name'][$i];
             $tipo = $coda['type'][$i];
             $filerror = $coda['error'][$i];
             if (in_array($thename, $totnames)) {
                 $thename = $filename . $i . "." . $filex;
             }
             if (Utils::notList($thename, array('.htaccess', '.htpasswd', '.ftpquota')) == true) {
                 array_push($totnames, $thename);
                 if ($thename) {
                     Actions::uploadFile($location, $thename, $tempname, $tipo);
                     // check uplad errors
                     FileManager::upLog($filerror);
                 }
             }
         }
     }
 }