title: How to get the file path in html <input type="file"> in PHP?
body: <p>Can somebody pls tell me how to get the filepath using html <code>&lt;input type="file"&gt;</code> in PHP?</p>
  
  <p>Here are my codes:</p>
  
  <p><b><code>index.php</code></b></p>
  
  <pre><code>&lt;form action="csv_to_database.php" method="get" &gt;
   &lt;input type="file" name="csv_file" /&gt;
   &lt;input type="submit" name="upload" value="Upload" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and in <b><code>csv_to_database.php</code></b></p>
  
  <pre><code>&lt;?php
  
   if (isset($_GET['csv_file'])) {
  
   $row = 1;
  
    if (($handle = fopen($_GET['csv_file'], "r")) !== FALSE) {
     while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
      $num = count($data);
      echo "&lt;p&gt; $num fields in line $row: &lt;br /&gt;&lt;/p&gt;\n";
      $row++;
      for ($c=0; $c &lt; $num; $c++) {
          echo $data[$c] . "&lt;br /&gt;\n";
      }
     }
     fclose($handle);
    }
  
   } 
  ?&gt;
  </code></pre>
  
  <p>My problem is, it only works when the csv data is in the same directory as my php files. I think I need to get the file path but I don't know how to do it.</p>