I'm trying to do a ftp client through php. I have the client working but with one hicup. Say I upload a file in firefox it will just upload the file name but when I try it in internet explorer I get the file location as well. (C:\\blah\blah) I was wondering how I would go about stripping it down to just the file name. Thanks
fintan.
Netizen
1:22 pm on Aug 18, 2004 (gmt 0)
What you want is basename [php.net]. As the example says:
<?php $path = "/home/httpd/html/index.php"; $file = basename($path); // $file is set to "index.php" $file = basename($path, ".php"); // $file is set to "index" ?>
Hope that helps.
fintan
2:07 pm on Aug 18, 2004 (gmt 0)
Thanks for the quick reply. That would strip out the path for ( C:\blah\blah.doc ) wouldn't it. What if the user has the doc in a different path the next time they go to upload a doc say ( D:\blah\blah.doc )
Is there away to account for that?
Netizen
2:45 pm on Aug 18, 2004 (gmt 0)
It will always leave you blah.doc, which I thought was what you wanted?