Multiple file upload with Symfony2

后端 未结 11 879
温柔的废话
温柔的废话 2020-12-01 02:12

I\'m trying to upload multiple files via a form, but I can only upload one file at a time, the last one I mark in the browser. Is there a way to upload more images with Symf

11条回答
  •  感情败类
    2020-12-01 02:49

    No extra classes needed (except the gallery_manger service but the issue you describe happens before...)

    I don't really know what's wrong. Check for your template (maybe wrong enctype... or name attr missmatching)

    first try to do a single file upload, check the documentation:

    1. file Field Type
    2. How to handle File Uploads with Doctrine

    Once it works, you have to edit some lines.

    1. add input file multiple attribute.
    2. append [] at the end of the input file name attribute (mine is create...[] because my form class name is create, if your is createType it will be createType...[])
    3. init $files as an array.

    Copy/paste your code here.

提交回复
热议问题