Click to See Complete Forum and Search --> : Directory Handling


hammerslane
11-17-2003, 10:46 AM
I know this is possible, but was just wondering what the right function was.
I'm basically running a variable called $CLIENT from 1.html to 2.html.

1.html is just a drop down box and whatever client you select (for example BARCLAYS BANK), the variable would be BAR.

2.php takes the variable, and looks in a directory called /FOLDERS for a folder named BAR (in this case) and then displays whatever files are in the folder.

The problem is, that if there is a client name and a variable added to the drop down box, there will be a Warning: opendir(\localhost\clients) [function.opendir]:
failed to open dir: Invalid argument error.

Is it possible to run an IF statement to check whether the folder exists, and if it doesn't, create a folder of the variable name in /FOLDER ?

I hope I've explained this properly... any pointers in the general right direction are accepted gratefully.

pyro
11-17-2003, 11:31 AM
Take a look at is_dir() (http://us2.php.net/manual/en/function.is-dir.php) and mkdir() (http://us2.php.net/manual/en/function.mkdir.php).

hammerslane
11-18-2003, 02:58 AM
thanks very much pyro - didn't think it'd be that easy...

pyro
11-18-2003, 07:18 AM
You bet... :)