Created
April 30, 2016 12:27
-
-
Save bwaidelich/d4351a8fdcc6cb04b18d1d2349aef2a1 to your computer and use it in GitHub Desktop.
Upload multiple resources in Neos Flow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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) | |
{ | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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, ...)