title: Image upload after submit using ajax
body: <p>I am trying to upload image using ajax. But i am getting this error:</p>
  
  <pre><code>Notice: Undefined index: Image in /Applications/MAMP/htdocs/request/insert.php on line 8
  
  Notice: Undefined index: Image in /Applications/MAMP/htdocs/request/insert.php on line 9
  </code></pre>
  
  <p>After clicked insert button then i am getting that error. The problem is just image section. Other details will still posting. There's something I missed.But I can not find. Anyone can help me here ?</p>
  
  <p>My ajax code is here:</p>
  
  <pre><code>// Insert 
    $("body").on("click",".insert", function(){
  
       var Desc = $(".Desc").val();
       var Title = $(".Title").val(); 
       var Image = $("#Image").val();
  
       var dataString = 'Desc=' + Desc +  '&amp;Title=' + Title + '&amp;Image=' + Image ;
       $.ajax({
          type: "POST",
          url:"request/insert.php",
          data: dataString,
          cache:false,
          success: function(html){
            // Do something   
          } 
       });
  
    });
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;form method="post" action="" id="Form" enctype="multipart/form-data"&gt;
     &lt;div class="file-field input-field"&gt;
        &lt;div class="btn"&gt;
           &lt;span&gt;File&lt;/span&gt;
           &lt;input type="file" name="Image" id="Image"&gt;
        &lt;/div&gt;
  
     &lt;/div&gt;
     &lt;div class="row"&gt;
        &lt;div class="row"&gt;
          &lt;div class="input-field col s12"&gt;
            &lt;textarea id="textarea1" name="Desc" class="materialize-textarea Desc"&gt;&lt;/textarea&gt;
            &lt;label for="textarea1"&gt;Textarea&lt;/label&gt;
          &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="row"&gt;
      &lt;div class="input-field col s6"&gt;
        &lt;input  name="Title" id="first_name2" type="text" class="validate Title"&gt;
        &lt;label class="active" for="first_name2"&gt;First Name&lt;/label&gt;
      &lt;/div&gt;
    &lt;/div&gt;
      &lt;div class="btn waves-effect waves-light insert" name="action"&gt;Submit
      &lt;i class="material-icons right"&gt;send&lt;/i&gt;
      &lt;/div&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>&lt;?php 
  include_once 'functions/db.php';
  if(isSet($_POST['Title']) &amp;&amp; isSet($_POST['Desc']) &amp;&amp; isSet($_POST['Image'])) {
  
      $Title = mysqli_real_escape_string($db, $_POST['Title']);
      $Desc = mysqli_real_escape_string($db, $_POST['Desc']);
  
      $Image = $_FILES['Image']['name'];
      $image_tmp= $_FILES['Image']['tmp_name'];
      move_uploaded_file($sliderPath);
  
      $insert_query = mysqli_query($db,"INSERT INTO Post(Title,Desc,Image) VALUES ('$Title','$Desc','$Image')") or die(mysqli_error($db));
  
  }
  ?&gt;
  </code></pre>