/** @return DirItem */ public final function saveUploadedFile($mandatory = true, $userId = null, array $params = array()) { check_condition(!self::$saved, 'Файл уже был обработан классом ' . self::$saved); self::$saved = $this->CLASS; $userId = $this->checkUserId($userId); $this->LOGGER->info("Uploading file for user [{$userId}]. Mandatory ? {}.", var_export($mandatory, true)); $file = new FILEAdapter($mandatory); $this->LOGGER->info($file); if (!$file->isValid()) { $this->LOGGER->info('Upload file is not valid, skip saving.'); return null; } $source = $file->moveUploadedFileTo($this->makeTmpDirItem()); $this->LOGGER->info("Uploaded file moved to {$source}."); return $this->uploadFileImpl($source, $file, $userId, $params); }