Skip to content

Instantly share code, notes, and snippets.

@bwaidelich
Created April 30, 2016 12:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwaidelich/d4351a8fdcc6cb04b18d1d2349aef2a1 to your computer and use it in GitHub Desktop.
Save bwaidelich/d4351a8fdcc6cb04b18d1d2349aef2a1 to your computer and use it in GitHub Desktop.
Upload multiple resources in Neos Flow
<f:form action="upload" enctype="multipart/form-data">
<f:form.upload name="resources[]" additionalAttributes="{multiple: true}" />
<f:form.submit value="Upload new resources"/>
</f:form>
<?php
namespace Your\Package\Controller;
class SomeController extends ActionController {
protected function initializeUploadAction()
{
$resourcesPropertyMappingConfiguration = $this->arguments->getArgument('resources')->getPropertyMappingConfiguration();
$resourcesPropertyMappingConfiguration->allowAllProperties();
}
/**
* @param array <Resource> $resources
* @return void
*/
public function uploadAction(array $resources)
{
// ...
}
@bwaidelich
Copy link
Author

Note: For more flexibility you should consider creating a custom ViewHelper (that could also allow you to re-display uploaded resources in case of validation error, ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment