title: Php Browse a file then get its path
body: <p>Been stumbling around the net having a difficulty finding a sample of getting a file path of a browsed file. Some of them I read that this function no longer works anymore due to security reasons. Any ideas guys? I badly need a sample. I already tried many times.</p>
  
  <p>This is currently I have:</p>
  
  <pre><code>&lt;html&gt;
  
  &lt;body&gt;
  
  
  &lt;form method="post" action="file.php" enctype="multipart/form-data"&gt;
  
  &lt;input type="radio" name="type" value="moodle" required="required" /&gt; Moodle&lt;br /&gt;
  &lt;input type="radio" name="type" value="bb" required="required" /&gt; BlackBoard&lt;br /&gt;
  &lt;input type="file" name="file" id="file" /&gt;&lt;br /&gt;&lt;br /&gt;
  
  &lt;input type="submit" value="Submit" name="submit" /&gt;
  
  &lt;/form&gt; 
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>the file.php </p>
  
  <pre><code>&lt;?php
  
  
  $filetype = $_POST["type"];
  
  
  
  
  echo $filetype;
  
  echo "Upload: " . $_FILES['file']['name'] . "&lt;br /&gt;";
  echo "Type: " . $_FILES['file']['tmp_name'];
  
  if ($_FILES['file']['error'] &gt; 0)
    {
    echo "Error: " . $_FILES["file"]["error"] . "&lt;br /&gt;";
    }
  else
    {
    echo "Upload: " . $_FILES['file']['name'] . "&lt;br /&gt;";
    echo "Type: " . $_FILES['file']['type'] . "&lt;br /&gt;";
    echo "Size: " . ($_FILES['file']['size'] / 1024) . " Kb&lt;br /&gt;";
    echo "Stored in: " . $_FILES['file']['tmp_name'];
    }
  
  
  function moodlezip($zipfile){
  
      echo "&lt;h1&gt;MOODLE&lt;/h1&gt;"."&lt;br /&gt;";
  
      $moodle = new Moodle();
      $zip = zip_open($zipfile);
      $ziparc = new ZipArchive;
  
  
      if ($zip)
      {
          while ($zip_entry = zip_read($zip))
          {
  
              $file = zip_entry_name($zip_entry);
  
              //echo "Name: " . $file . "&lt;br /&gt;";
  
  
              if (strpos($file,'course.xml') !== false) {
  
                  if ($ziparc-&gt;open($zipfile) === TRUE) {
  
                      $coursexml =  new SimpleXMLElement($ziparc-&gt;getFromName($file));
  
                      $moodle-&gt;getCourse($coursexml);
  
                      $ziparc-&gt;close();
  
  
                  } else {
                      echo 'failed';
                  }
  
  
              }
  
              else if (strpos($file,'forum.xml') !== false) {
  
                  if ($ziparc-&gt;open($zipfile) === TRUE) {
  
                      $topicxml =  new SimpleXMLElement($ziparc-&gt;getFromName($file));
  
                      $moodle-&gt;getTopic($topicxml);
  
                      $ziparc-&gt;close();
  
  
                  } else {
                      echo 'failed';
                  }
  
  
              }
  
  
  
              else if (strpos($file,'lesson.xml') !== false) {
  
                  if ($ziparc-&gt;open($zipfile) === TRUE) {
  
                      $lessonxml =  new SimpleXMLElement($ziparc-&gt;getFromName($file));
  
                      $moodle-&gt;getLessons($lessonxml);
  
                      $ziparc-&gt;close();
  
  
                  } else {
                      echo 'failed';
                  }
  
  
              }
  
  
  
              else if (strpos($file,'quiz.xml') !== false) {
  
                  if ($ziparc-&gt;open($zipfile) === TRUE) {
  
                      $quizxml =  new SimpleXMLElement($ziparc-&gt;getFromName($file));
  
                      $moodle-&gt;getQuizzes($quizxml);
  
                      $ziparc-&gt;close();
  
  
                  } else {
                      echo 'failed';
                  }
  
  
              }
  
  
              else if (strpos($file,'questions.xml') !== false) {
  
                  if ($ziparc-&gt;open($zipfile) === TRUE) {
  
                      $questionsxml =  new SimpleXMLElement($ziparc-&gt;getFromName($file));
  
                      $moodle-&gt;getQuestions($questionsxml);
  
                      $ziparc-&gt;close();
  
  
                  } else {
                      echo 'failed';
                  }
  
  
              }
  
  
          }
  
          zip_close($zip);
      }
  
  }
  
  require_once 'classes/backup.php';
  
  $connect = mysql_connect("localhost","root","");
  
  
  if (!$connect)
  {
      die('Could not connect: ' . mysql_error());
  }
  
  mysql_close($connect);
  
  
  //form upload loop folders input submit, find, bb, scorm
  //class admin
  ?&gt;
  </code></pre>