title: How to submit dynamic file type with FormData() jquery and receive it in php
body: <p><p>For single file upload it's working fine, see below example</p>
  
  <pre><code>&lt;input name="audio_preview" id="audio_preview" type="file"&gt;
  
  var formData = new FormData();
  var audio_preview = document.getElementById('audio_preview');
  var audio_preview_file = audio_preview.files[0];
  formData.append('audio_preview', audio_preview_file);
  </code></pre>
  
  <p>Now receive it in php</p>
  
  <pre><code>[audio_preview] =&gt; Array
       (
         [name] =&gt; bawa_sus-bawa_sus-10511_hifi.mp3
         [type] =&gt; audio/mpeg
         [tmp_name] =&gt; /customers/4/6/d/domain.com/tmp/phpUTkVgr
         [error] =&gt; 0
         [size] =&gt; 116737
        )
  </code></pre>
  
  <p><p>Above code is working fine, but now i want to submit dynamic file input     field, check below code<p></p>
  
  <pre><code>&lt;input name="download_files[]" type="file"&gt;
  &lt;input name="download_files[]" type="file"&gt;
  &lt;input name="download_files[]" type="file"&gt;
  &lt;input name="download_files[]" type="file"&gt;
  
  &lt;script&gt;
  var allFiles = jQuery("input[name='download_files[]']");
   jQuery.each(allFiles,function(index, value){
      formData.append('download_files[]', value.files[0]);
   });
  &lt;/script&gt;
  </code></pre>
  
  <p>It sends below array</p>
  
  <pre><code>[download_files] =&gt; Array
          (
              [name] =&gt; Array
                  (
                      [0] =&gt; ajax-loader.gif
                      [1] =&gt; already-subscribed-help.gif
                  )
  
              [type] =&gt; Array
                  (
                      [0] =&gt; image/gif
                      [1] =&gt; image/gif
                  )
  
              [tmp_name] =&gt; Array
                  (
                      [0] =&gt; /customers/4/6/d/domain.com/tmp/phpnd9czo
                      [1] =&gt; /customers/4/6/d/domain.com/tmp/phpNC4BlI
                  )
  
              [error] =&gt; Array
                  (
                      [0] =&gt; 0
                      [1] =&gt; 0
                  )
  
              [size] =&gt; Array
                  (
                      [0] =&gt; 19110
                      [1] =&gt; 7805
                  )
            )
   )
  </code></pre>
  
  <p>AJAX </p>
  
  <pre><code>$.ajax({
              type: 'post',
              url: $form.attr('action'),
              data: formData,
              processData: false, // Don't process the files
              contentType: false,
              success: function(s) {
                  alert('files uploaded');
                  jQuery( '.wordpress-ajax-form' ).each(function(){
                      this.reset();
                  });
                  jQuery("#sucess").show().delay(4000).fadeOut();
              },
              error: function(xhr) {
                  alert("An error occured files uploaded: " + xhr.status + " " + xhr.statusText);
              }
          });
  </code></pre>
  
  <p>How to submit files with FormData() using jQuery.</p>