title: Why does PHP store uploaded files in a temporary location and what is the benefit?
body: <p>Okay I'm totally new in this field and going through some tutorials and I found that while uploading files in PHP it stores them in a temporary location. </p>
  
  <pre><code>$file_temp=$_FILES['file']['tmp_name'];
  $file_loc="Upload".$file_name;
  move_uploaded_files($file_temp,$file_loc);
  </code></pre>
  
  <p>Now why doesn't PHP allow uploading files directly to the desired location? Why they are stored in a temporary location with a .tmp extension and what benefit do we get from this strategy?</p>