title: Laravel 5.4 not able to parse FormData javascript object sent using Jquery Ajax
body: <p>Lately I've been trying to solve an issue with no luck, basically I'm trying to submit a form to the server using AJAX, the form has files, so I'm using the <code>FormData</code> javascript object in JQuery 1.12. The data arrives to the server but in I way I don't know how to format it.</p>
  
  <p>This is my AJAX function:</p>
  
  <pre><code>function saveMenu(id){
      var formElement = document.getElementById("menu-form");
      var formData = new FormData(formElement);
      formData.append('_method', 'PUT');
      $( "#form-wrapper" ).toggleClass( "be-loading-active" );
      $.ajax({
          type: 'PUT',
          headers: {
              'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          },
          url: "{{url('myUrl')}}",
          data: formData,
          enctype: 'multipart/form-data',
          processData: false,
          success: function(response) {
              toastr.success('Yai! Saved successfully!')
          },
          error: function(response) {
              toastr.error('Oh oh! Something went really wrong!')
          },
          complete: function() {
              $( "#form-wrapper" ).toggleClass( "be-loading-active" )
          }
      });
  }
  </code></pre>
  
  <p>and when I perform a <code>dd($request-&gt;all());</code> in my controller I get something like this:  </p>
  
  <pre><code>array:1 [
    "------WebKitFormBoundaryRCIAg1VylATQGx46\r\nContent-Disposition:_form-data;_name" =&gt; """
      "_token"\r\n
      \r\n
      jtv4bnn8WQnP3eqmKZV3xWka2YOpnNc1pgrIfk0D\r\n
      ------WebKitFormBoundaryRCIAg1VylATQGx46\r\n
      Content-Disposition: form-data; name="blocks[43][title]"\r\n
      \r\n
  ...
  </code></pre>
  
  <p>Things I've tried: </p>
  
  <ul>
  <li>Set the HTTP verb to POST. Same result.</li>
  <li>Set the AJAX <code>contentType: false</code>, <code>contentType: application/json</code>. Empty response.</li>
  <li>Remove <code>enctype: 'multipart/form-data'</code>. Same response.</li>
  </ul>
  
  <p>Any help is appreciated.</p>