Reputation: 10084
I've read this part of symfony2 doc: http://symfony.com/doc/current/cookbook/doctrine/file_uploads.html and made it work for me. But what if I have a collection of 'file' fields with 'allow_add' attribute, so I don't know how many files will user post via form? How to handle them in the same way?
Upvotes: 0
Views: 381
Reputation: 70426
You need to tell your form to accept multiple files like this
{{ form_widget(form.file, { 'attr': { 'multiple': 'multiple' } }) }}
or this
{{ form_widget(yourForm.file, { 'full_name':
yourForm.file.get('full_name') ~ '[]' }) }}
read it here https://github.com/symfony/symfony/issues/1400
This way you can select and upload multiple files at once.
Upvotes: 2