I have a problem in PHP. I am using <input type=file>
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.
But using <input type=file>
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.
How do I do this ? Or is there a better way to solve this problem?
EDIT:
I am using something like this in say a file named 1.html:
<form method="post" action="update.php">
<input type="file" name="attachment" id="attachment"></td> </tr>
</form>
Now, in update.php I am using something like this:
$logpath1=$_POST['attachment'];
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.
So, how do I strip the filename from the path?
Example: if user selects,
C:\Documents and Settings\myusee\Desktop\new 2.cpp
I want to strip off new 2.cpp
.
I am not sure how can I use explode. Moreover I am running on XAMPP Lite.