[SOLVED] How to convert an uploaded File to an asset?

I have an form to upload a file.
The upload works great but I don’t get the right ‘__flow_object_type’.

How I get the Information of the File:

     $fileElementIdentifier = $this->parseOption('fileElementIdentifier');
     if ($fileElementIdentifier !== null) {
          $formValues = $this->finisherContext->getFormValues();
          $file = Arrays::getValueByPath($formValues, $fileElementIdentifier);
          if (!$file instanceof PersistentResource) {
               $file = null;

the Node entry in the Database for ‘file’ is:

"file": {
    "__flow_object_type": "Neos\\Flow\\ResourceManagement\\PersistentResource",
    "__identifier": "%%"

But I expect something like:

 "file": {
    "__flow_object_type": "Neos\\Media\\Domain\\Model\\Document",
    "__identifier": "%%"

I need a script to create an asset from a persistence Resource

Actually just something like:

$asset = new Document($resource);

Should do the trick

Thank you it works :slight_smile: