private function uploadFile(File $file) { $file->setName($this->getUniqueFileName($file->getPath(), $file->getName())); if (!$this->fileSystem->writeStream($file->getUuid()->toString(), $file->getStream())) { throw new \RuntimeException('Failed to process uploaded file.'); } $file->setStream($this->getFileStream($file->getUuid())); }