示例#1
0
文件: Dir.php 项目: point/cassea
 /**
  * Сохраняет файлы из UploadedFiles в директорию.
  *
  * Возвращает массив загруженных файлов.
  *
  * @throws FileSystemException если перемещение файлов прошло неуспешно.
  * @return array (File)
  */
 public function upload(UploadedFiles $uf)
 {
     $res = array();
     foreach ($uf->getUploaded() as $f) {
         if (move_uploaded_file($f['tmp_name'], $f = $this->getFile($f['name']))) {
             $res[] = $f;
         } else {
             throw new FileSystemException('Fail in move_uploaded_file: ' . $f['name']);
         }
     }
     return $res;
 }