title: How to cancel upload file to server and delete file (between upload not finished) when we use ajax post requests to upload file?
body: <p>How to cancel upload file to server and delete file (between upload not finished) when we use ajax post requests to upload file ?</p>
  
  <p>this is my ajax upload</p>
  
  <pre><code>$.ajax({
      url: 'example.php',
      dataType: 'text',
      cache: false,
      contentType: false,
      processData: false,
      data: form_data,                         
      type: 'post',
      success: function(php_script_response){
      }
  });
  </code></pre>
  
  <p>example.php</p>
  
  <pre><code>move_uploaded_file($_FILES["file"]["tmp_name"], "dir/" . $_FILES["file"]["name"]);
  </code></pre>