Symfony 2 Form collection field with type file

前端 未结 4 883
悲&欢浪女
悲&欢浪女 2021-02-19 09:49

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:



        
4条回答
  •  逝去的感伤
    2021-02-19 10:26

    The code in the form class is correct, but you also should modify the name of the formfield. The full_name should be form[pictures][] in your case.

    It actually seems that modifying a form field name is not possible anymore in sf2.3, but it will be possible in sf2.4 again.

    https://github.com/bamarni/symfony/commit/35639824e864ed8d4a4cc0d8360f2c73ae08b507#commitcomment-3627879

提交回复
热议问题