Neos Fusion Form and upload asset

Hi everyone,

I’m creating my first backend module with Neos 5.1 and Fusion Form.
So far my backend module is running, but I’m struggling with uploading a file.

Can anyone give me a hint what I have to do?

Thx a lot!

What I tried:

My controller:

 * Import and save uploaded excel file
 * @param Asset $asset Excel file to import
 * @return void
 * @throws \Exception
public function importAction(Asset $asset): void

And my Root.fusion looks like this:

include: resource://Neos.Fusion/Private/Fusion/Root.fusion
include: resource://Neos.Fusion.Form/Private/Fusion/Root.fusion

# Map controller pathes to fusion prototypes
# Vendor.Package.<@if Subfolder>.<MyController>.<action>
DIU.Neos.ExcelImporter.Module.BackendController.index = DIU.Neos.ExcelImporter:Importer.IndexForm {
    asset = ${asset}
    importStats = ${importStats}
    targetAction = 'import'

# The rendering of the form is centralized in a single prototype
# that expects the values `user` and `targetAction`
prototype(DIU.Neos.ExcelImporter:Importer.IndexForm) < prototype(Neos.Fusion:Component) {

    # fusion api
    asset = null
    targetAction = null

    renderer = afx`

        <Neos.Fusion.Form:Form{props.asset}{props.targetAction} >

            <Neos.Fusion.Form:Neos.BackendModule.FieldContainer"asset[file]" >
                <Neos.Fusion.Form:Upload />



That part of fusion forms may be incomplete. Especially when validation failes on the target controller and a form is rendered again. What happens in your case?

On the flow side the upload does not create an asset directly but an Neos\Flow\Http\UploadedFile that you can convert to an asset in your controller. Maybe that is the only thing you have to adjust.