title: upload form with image to ajax and php
body: <p>i doing image upload to ajax and send to php with a form .but i have search a lot of source but still no idea.can anyone help me complete the code ?   </p>
  
  <pre><code> &lt;form name="registerform" id="data"&gt;
      &lt;div id="formleft"&gt;
               &lt;input type="email" name="email" placeholder="Email Address"&gt;&lt;br&gt;
              &lt;input type="file" id="pic" name="profile_pic" class="image_input" /&gt;
      &lt;input type="button" name="register" value="Sign Up" onclick="re2()" /&gt;&lt;br&gt;
      &lt;/div&gt;
   &lt;/form&gt;
  
  
  function re2()
  {
  
  var image=document.getElementById("pic").src;
  var re_email1=$("[name=register_email]").val();
  $.ajax({
      type : "get",
      url : "add.php",
      data :      "type=regis2&amp;image="+image+"&amp;re_email="+email,
      success : function(data){
          alert(data);
  */ how i get the image file from form and pass the file to here and send ?? */      
  
      }
  });
  
  }
  
  
  
   &lt;?php
   if ($_GET['type'] == "regis2") 
   {
   $image=$_GET['image'];
   $email=$_GET['re_email'];
   $target_Path = 'image/';
   $target_Path = $target_Path.basename( $_FILES['image']['name'] );
   move_uploaded_file($_FILES["image"]["tmp_name"] , $target_Path);
   }
   ?&gt;
  
  
  }
  </code></pre>
  
  <p>how can i pass image using ajax.becuase i have search by google but still no idea. can anyone complete the code for me?
  really need a lot of help </p>