/** * Сохраняет файлы из 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; }