importUploadedResource() public method

On a successful import this method returns a PersistentResource object representing the newly imported persistent resource.
public importUploadedResource ( array $uploadInfo, string $collectionName = self::DEFAULT_PERSISTENT_COLLECTION_NAME ) : PersistentResource
$uploadInfo array An array detailing the resource to import (expected keys: name, tmp_name)
$collectionName string Name of the collection this uploaded resource should be added to
return PersistentResource A resource object representing the imported resource
 /**
  * @param array $source
  * @param PropertyMappingConfigurationInterface $configuration
  * @return PersistentResource|FlowError
  * @throws \Exception
  */
 protected function handleFileUploads(array $source, PropertyMappingConfigurationInterface $configuration = null)
 {
     if (!isset($source['error']) || $source['error'] === \UPLOAD_ERR_NO_FILE) {
         if (isset($source['originallySubmittedResource']) && isset($source['originallySubmittedResource']['__identity'])) {
             return $this->persistenceManager->getObjectByIdentifier($source['originallySubmittedResource']['__identity'], PersistentResource::class);
         }
         return null;
     }
     if ($source['error'] !== \UPLOAD_ERR_OK) {
         switch ($source['error']) {
             case \UPLOAD_ERR_INI_SIZE:
             case \UPLOAD_ERR_FORM_SIZE:
             case \UPLOAD_ERR_PARTIAL:
                 return new FlowError(Files::getUploadErrorMessage($source['error']), 1264440823);
             default:
                 $this->systemLogger->log(sprintf('A server error occurred while converting an uploaded resource: "%s"', Files::getUploadErrorMessage($source['error'])), LOG_ERR);
                 return new FlowError('An error occurred while uploading. Please try again or contact the administrator if the problem remains', 1340193849);
         }
     }
     if (isset($this->convertedResources[$source['tmp_name']])) {
         return $this->convertedResources[$source['tmp_name']];
     }
     try {
         $resource = $this->resourceManager->importUploadedResource($source, $this->getCollectionName($source, $configuration));
         $this->convertedResources[$source['tmp_name']] = $resource;
         return $resource;
     } catch (\Exception $exception) {
         $this->systemLogger->log('Could not import an uploaded file', LOG_WARNING);
         $this->systemLogger->logException($exception);
         return new FlowError('During import of an uploaded file an error occurred. See log for more details.', 1264517906);
     }
 }