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:
public $pictures;
public function __construct()
{
$this->pictures = new \Doctrine\Common\Collections\ArrayCollection();
}
Code in Form Class:
$builder->add('pictures', 'collection', array(
'type' => 'file',
'required' => false,
'attr' => array(
'multiple' => 'multiple'
)
));
Code in Twig:
{% for picture in form.pictures %}
<td>
{{ form_widget(picture) }}
</td>
{% endfor %}
I tried, but it doesn't seem to work. It is not showing any errors, but it is not showing the input file either. Any ideas?