title: PHP AJAX jQuery send file and text
body: <p>Hi everyone I have a simple form with input for text and file. I want to type some name in input and add file. Here is my HTML code:</p>
  
  <pre><code>Name: &lt;input type="text" id="name" name="name"&gt;&lt;br&gt;
  File: &lt;input type="file" id="file" name="file"&gt;&lt;br&gt;
  &lt;button id="submit"&gt;Submit&lt;/button&gt;
  </code></pre>
  
  <p>And this is my simple jQuery code:</p>
  
  <pre><code>$('#submit').click(function() {
      var file_data = $('#file').prop('files')[0];   
      var form_data = new FormData();                  
      form_data.append('file', file_data);
      $.ajax({
          url: 'include/upload_idcard.php',
          dataType: 'text',
          cache: false,
          contentType: false,
          processData: false,
          data: form_data,                         
          type: 'post',
          success: function(result){
              alert(result);
          }
      });
  });
  </code></pre>
  
  <p>And in PHP I take the file and etc. But I want the file and the name(input). How to the and the value in input(name)?
  Thanks.</p>