title: save data into mysql together with upload image using jquery and php
body: <p>this is my first time getting here. </p>
  
  <p>I'm currently creating a form toinsert data string into mysql database and uploading an image together. Image name must be saved in mysql DB and the file must be moved to a folder, let's name it "image/" folder.</p>
  
  <p>I use jquery for inserting the data. Below is piece of code I've tried:</p>
  
  <p>Form:</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" method="post" action="" id="formBerita"&gt;
  &lt;div&gt;
   Title:
      &lt;div&gt;&lt;input type="text" id="title" name="the_title" placeholder="Your title here..." autocomplete="off"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div&gt;
   Content :
      &lt;div&gt;&lt;textarea id="content" name="the_content"&gt;&lt;/textarea&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div&gt;
  &lt;input type="hidden" name="max_size" value="300000"&gt;
  Image:
  &lt;div&gt;&lt;input id="img" name="the_img" type="file" /&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;input type="button" id="btnSave" value="Save"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>jQuery for inserting:</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function(){
    $('#btnSave').on('click', function(){
      var title = $("#title").val();
      var content = $("#content").val();
      var img = $("#img").val();
      var dataContent = 'title='+title+'&amp;content='+content+"&amp;img="+img;
      if(!title){
          alert("You must fill the title!");
            $("#title").focus();
      }
      else {
          $.ajax({
              type: "post",
              url: 'includes/saveContent.php',
              data: dataContent,
              beforeSend: function() {
                  respon.contentColumn.append(respon.loader);   //just loader before saving the data
              },
              success: function(datas) {
                  respon.contentColumn.find(respon.loader).remove();
              }
          });
      }
    });
  });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>saveContent.php file:</p>
  
  <pre><code>&lt;?php
  
  $title = $_POST['title'];
  $content  = $_POST['content'];
  $img  = $_POST['img'];
  
  $query = "INSERT INTO tbl_content VALUES('','$title','$content','$img')";
  mysql_query($query);
  
  ?&gt;
  </code></pre>
  
  <p>So far, the above code works well. But, I'm still confusing how to upload and move the image file to a certain directory or folder using jQuery and PHP. </p>
  
  <p>As we all know, generally in php we use: </p>
  
  <p><code>move_uploaded_file($tempNama=$_FILES['fileName']['tmp_name'], $fileDestination);</code></p>
  
  <p>for moving the image file to a destination folder.</p>
  
  <p>So, the question: what should I add to complete my code so the image file can be uploaded and moved to a destination directory? </p>