Creating a directory browser

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
filch
Forum Newbie
Posts: 22
Joined: Sat Oct 25, 2003 12:34 pm
Location: Toronto

Creating a directory browser

Post by filch »

Hello all,

I am trying to create a function to be able to browse a directory, change directories and select a file and be able to store that selection path in a variable for storage in a database. The key for me is to be able to store a path to a directory (no file selection) and also then chose the file, and thus have it's file path available for storage in a DB.

I have come up with ways to list the files in a directory, but what I do not know how to do is create the ability to "BROWSE" the directories. For instance, if I want to upload a file to the server, I want to be able to browse to and choose where I want to upload the file. If I want to add a path to an image to a database, I want to be able to "BROWSE" to the file, select it and have it's path stored in a variable and then it could be stored in the DB.

Again, getting a directory list is not so hard ... browsing seems to be eluding me. I am relatively new to PHP so that might be a clue why ... but hey ... I'm trying ;-)

Can someone point me in the right direction?

Dave
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Take a look at the opendir(), readdir() and pathinfo() fns.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

if i see how you browse i might be able to offer a suggestion on how to capture the path.
Post Reply