public function importUploadedResource(array $uploadInfo, $collectionName = self::DEFAULT_PERSISTENT_COLLECTION_NAME)
{
$this->initialize();
if (!isset($this->collections[$collectionName])) {
throw new Exception(sprintf('Tried to import an uploaded file into the resource collection "%s" but no such collection exists. Please check your settings and HTML forms.', $collectionName), 1375197544);
}
/* @var CollectionInterface $collection */
$collection = $this->collections[$collectionName];
try {
$uploadedFile = $this->prepareUploadedFileForImport($uploadInfo);
$resource = $collection->importResource($uploadedFile['filepath']);
$resource->setFilename($uploadedFile['filename']);
} catch (Exception $exception) {
throw new Exception(sprintf('Importing an uploaded file into the resource collection "%s" failed.', $collectionName), 1375197680, $exception);
}
$this->resourceRepository->add($resource);
$this->systemLogger->log(sprintf('Successfully imported the uploaded file "%s" into the resource collection "%s" (storage: "%s", a %s. SHA1: %s)', $resource->getFilename(), $collectionName, $this->collections[$collectionName]->getStorage()->getName(), get_class($this->collections[$collectionName]->getStorage()), $resource->getSha1()), LOG_DEBUG);
return $resource;
}