I want to upload multiple files with POST request (without Ajax). Can I use Symfony 2\'s form collection field with type file like this:
Code in Entity:
You need to specify the type of the widget in collection
Look at the: http://symfony.com/doc/2.0/reference/forms/types/collection.html
$builder->add('pictures', 'collection', array(
// each item in the array will be an "email" field
'type' => 'file',
// these options are passed to each "email" type
'options' => array(
'required' => false,
),
));
For further reading I suggest
http://symfony.com/doc/2.0/reference/forms/types/file.html
Also you need to add sth to this collection to display cuz it will be empty when initialize like in your constructor of entity.