vitiko / IphpFileStoreBundle

Symfony 2 file upload for doctrine entities
http://symfonydev.ru/iphpfilestorebundle/
51 stars 23 forks source link

Multiple upload #10

Open cve opened 10 years ago

cve commented 10 years ago

Hi.

Is it possible to handle multiple file upload in that easy way?

morozow commented 10 years ago

May be it helps you if you want to have as multiple upload so multiple created fields

foreach ($form->getData()->getPhoto() as $index => $photo) {
    $photoItem = new Photo();
    $photoItem->setPhoto($photo);
    $em->persist($photoItem);
}
$em->flush();

And only mark photo field in Form Builder as multiple

...
 ->add ('photo', 'file', array(
     'multiple' => 'multiple'
 ));
....