title: how to get full path of uploaded file in php?
body: <p>My code snippet so far: </p>
  
  <pre><code>if(isset($_POST['submit']))  {
      $uploaddir = '/www/csvExtraction/uploads/';
      $uploadfile = $uploaddir . basename($_FILES['file']['name']);
      if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
      }
  </code></pre>
  
  <p>Still i get this error </p>
  
  <blockquote>
    <p>Undefined index: file in C:\wamp\www\csvExtraction\index.php </p>
  </blockquote>
  
  <hr>
  
  <p>Whole Code : 
      
  
  <pre><code>if(!$db)
  
  die("no db");
  
  if(!mysqli_select_db($db,"phptester"))
  
  die("No database selected.");
  
  if(isset($_POST['submit']))
  {
  $uploaddir = '/www/csvExtraction/uploads/';
  $uploadfile = $uploaddir . basename($_FILES['file']['name']);
  
  if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) 
  {
  
  $handle = fopen("$uploadfile", "r");
  while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
  {
  $import="INSERT into sample(id,name,address) values('$data[0]','$data[1]','$data[2]')";
  mysqli_query($import) or die(mysql_error());
  }
  fclose($handle);
  print "Import done";
  }
  }
  else
  
  {
  
  print "&lt;form action='index.php' method='post'&gt;";
  
  print "Choose file to import:&lt;br&gt;&lt;br&gt;";
  
  print "&lt;input type='file' name='file' id='file'&gt;&lt;br&gt;&lt;br&gt;";
  
  //print "&lt;input type='text' name='filename' size='20'&gt;&lt;br&gt;";
  
  print "&lt;input type='submit' name='submit' value='extract'&gt;&lt;/form&gt;";
  
  }
   ?&gt;
  </code></pre>