Symfony 2-Formularsammlungsfeld mit Typdatei
Ich möchte mehrere Dateien mit POST-Anforderung hochladen (ohne Ajax). Kann ich das Formularsammlungsfeld von Symfony 2 mit einer Typdatei wie der folgenden verwenden:
Code in Entität:
public $pictures;
public function __construct()
{
$this->pictures = new \Doctrine\Common\Collections\ArrayCollection();
}
Code in Formularklasse:
$builder->add('pictures', 'collection', array(
'type' => 'file',
'required' => false,
'attr' => array(
'multiple' => 'multiple'
)
));
Code im Zweig:
{% for picture in form.pictures %}
<td>
{{ form_widget(picture) }}
</td>
{% endfor %}
Ich habe es versucht, aber es scheint nicht zu funktionieren. Es werden keine Fehler angezeigt, aber es wird auch nicht die Eingabedatei angezeigt. Irgendwelche Ideen?