title: Selecting folder path using input type file
body: <p>I have a problem in PHP. I am using <code>&lt;input type=file&gt;</code> to get the file name from the user. 
  Basically I want to store the just folder path and not the file, so that when I display the path using hyperlink, the user can open the directory. </p>
  
  <p>But using <code>&lt;input type=file&gt;</code> the user has to select a file then only the file textbox will get filled. Now I want to strip off the last part of the filename. </p>
  
  <p>How do I do this ? Or is there a better way to solve this problem?</p>
  
  <p>EDIT:</p>
  
  <p>I am using something like this in say a file named 1.html:</p>
  
  <pre><code>&lt;form method="post" action="update.php"&gt;
      &lt;input type="file" name="attachment" id="attachment"&gt;&lt;/td&gt; &lt;/tr&gt;
   &lt;/form&gt;
  </code></pre>
  
  <p>Now, in update.php I am using something like this:</p>
  
  <pre><code>$logpath1=$_POST['attachment'];
  </code></pre>
  
  <p>Basically I am getting the file name in $logpath1 that user selects.
  But the thing is input type = file will only work for files and not folders. </p>
  
  <p>So, how do I strip the filename from the path?</p>
  
  <p>Example: if user selects,</p>
  
  <pre><code>C:\Documents and Settings\myusee\Desktop\new 2.cpp
  </code></pre>
  
  <p>I want to strip off <code>new 2.cpp</code>.</p>
  
  <p>I am not sure how can I use explode. Moreover I am running on <a href="http://www.apachefriends.org/en/xampp-windows.html#646" rel="nofollow noreferrer">XAMPP Lite</a>.</p>