title: Blueimp jQuery file upload and symfony2 : issue with custom upload handler
body: <p>I'm using Symfony2 and I would like to use the BlueImp plugin, <a href="https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin" rel="nofollow">basic setup</a>.</p>
  
  <p>Actually, I have a form in which you can load 3 pictures and one song (it is for an artist registration).</p>
  
  <p>As a start, I try to implement the plugin for just one picture. But when I select a file in my input "picture 1", nothing happens.. What is wrong ? </p>
  
  <pre><code>&lt;html&gt;
   &lt;head&gt;
      &lt;script type="text/javascript"  src="{{ asset('bundles/mybundle/js/jquery-file-upload/js/vendor/jquery.ui.widget.js') }}"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"  src="{{ asset('bundles/mybundle/js/jquery-file-upload/js/jquery.iframe-transport.js') }}"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"  src="{{ asset('bundles/mybundle/js/jquery-file-upload/js/jquery.fileupload.js') }}"&gt;&lt;/script&gt;
    &lt;/head&gt;
  
  
   &lt;form id="myForm" action="{{ path('MyBundle_artist_new') }}" {{ form_enctype(form) }} method="post" novalidate&gt;
       &lt;div class="field"&gt;
          {{ form_label(form.picture1 "Picture 1") }}
          {{ form_widget(form.picture1) }}
        &lt;/div&gt;
        &lt;input type="submit" value="Register"/&gt;
  &lt;/form&gt;
  
  &lt;script type="text/javascript"&gt;
  
  $(document).ready(function(){
  
      $('#myform_picture1').fileupload(
      {
          dataType: 'json',
          url:'{{path('MyBundle_ajax_upload_picture') }}',
          done: function (e, data) {
              $.each(data.result.files, function (index, file) {
                  $('&lt;p/&gt;').text(file.name).appendTo(document.body);
              });
          }
      });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here is <b>upload handler</b> (the action for the url {{path('MyBundle_ajax_upload_picture') }} :</p>
  
  <pre><code>&lt;?php
  
      public function ajaxUploadPicture()
      {
          $request = $this-&gt;get('request');
          $uploaded_file = $request-&gt;files-&gt;get('myform_picture1');
  
          if ($uploaded_file) 
          {
              $picture1 = $this-&gt;processImage($uploaded_file);
              $picture1-&gt;setPath('pictures/artist/' . $picture1);
              $em-&gt;persist($picture1);
              $em-&gt;flush();
  
              $response = 'success';
          }
  
          else $response= 'error';
  
          $response = new Response(json_encode(array('response'=&gt;$response)));
          $response-&gt;headers-&gt;set('Content-Type', 'application/json');
          return $response;
      }
  
      public static function processImage(UploadedFile $uploaded_file)
      {
          $path = 'pictures/artist/';
          $uploaded_file_info = pathinfo($uploaded_file-&gt;getClientOriginalName());
          $filename = uniqid() . "." .$uploaded_file_info['extension'];
  
          $uploaded_file-&gt;move($path, $filename);
  
          return $filename;
      }
  </code></pre>