I am trying to process dropzone.js to work correctly with my symfony formbuilder entity.
Everything works correctly if I use a simple <input type="file" id="form_file" name="form[file]">
BUT, if I use dropzone.js, I get this difference in my POST: 
How can I handle this?
This is my js for this:
Dropzone.options.myAwesomeDropzone = { autoProcessQueue: false, uploadMultiple: true, parallelUploads: 25, maxFiles: 25, init: function() { var myDropzone = this; $("#submit-all").click(function (e) { e.preventDefault(); e.stopPropagation(); myDropzone.processQueue(); } ); } }
My form file is as follows:
<form id="my-awesome-dropzone" class="wizard-big dropzone" action="{{ path('add') }}" method="post" {{ form_enctype(form) }}> {{ form_widget(form.name, {'attr': { 'class': 'form-control' } }) }} <div class="row"> <div class="dropzone-previews"></div> <div class="fallback"> {{ form_widget(form.file, {'attr': { 'class': 'cotam' } }) }} </div> </div> <button type="submit" id="submit-all" class="btn">Upload the file</button> {{ form_rest(form) }} </form>
And my controller:
public function addAction(Request $Request) { $photo = new Photo(); $form = $this->createFormBuilder($photo) ->add('name') ->add('file') ->getForm(); $form->handleRequest($Request); if ($form->isValid() && $Request->isMethod('POST')) { $em = $this->getDoctrine()->getManager(); $em->persist($photo); $em->flush(); $this->redirect($this->generateUrl('add')); } return $this->render('MyBundle::add.html.twig', array( 'form' => $form->createView() )); }
could you help me?
Gemmi source share