madspof Posted June 25, 2007 Share Posted June 25, 2007 i cannot seem to find away of creating a folder using php for example a client could make a folder on the server using php Quote Link to comment Share on other sites More sharing options...
per1os Posted June 25, 2007 Share Posted June 25, 2007 http://us2.php.net/mkdir Should work. Quote Link to comment Share on other sites More sharing options...
madspof Posted June 25, 2007 Author Share Posted June 25, 2007 Is there a php function that can scan a directory to check to see if a certain folder exists or not Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 25, 2007 Share Posted June 25, 2007 in dos it's just "dir" but lemme check if it's the same in PHP Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 25, 2007 Share Posted June 25, 2007 chdir — Change directory chroot — Change the root directory dir — Directory class closedir — Close directory handle getcwd — Gets the current working directory opendir — Open directory handle readdir — Read entry from directory handle rewinddir — Rewind directory handle scandir — List files and directories inside the specified path And then you can use in_array on your error. Quote Link to comment Share on other sites More sharing options...
madspof Posted June 25, 2007 Author Share Posted June 25, 2007 okay well i was check these command over but they dont seem to check the directory specied for folders i do not want to scan file jsut other directories is this possible Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 25, 2007 Share Posted June 25, 2007 I don't know sorry, but you can manually delete other files you know are in there I guess. Quote Link to comment Share on other sites More sharing options...
madspof Posted June 25, 2007 Author Share Posted June 25, 2007 okay let me try one more time is there some kind of function that can scan a directory and jsut show the folders in the directory Quote Link to comment Share on other sites More sharing options...
trq Posted June 25, 2007 Share Posted June 25, 2007 okay let me try one more time is there some kind of function that can scan a directory and jsut show the folders in the directory Sometimes you actually need to write some code. <?php function show_dirs($path) { $dir = scandir($path); foreach ($dir as $node) { if (is_dir($path.'/'.$node)) { echo $node."\n"; } } } ?> Quote Link to comment Share on other sites More sharing options...
madspof Posted June 26, 2007 Author Share Posted June 26, 2007 is it possible for me to put a variable into the mkdir function for example the main reason is that I want this script is so that the path name created can be a username from a login. <?php $varaible = 'hi'; mkdir("/path/'$variable'", 0700); ?> Quote Link to comment Share on other sites More sharing options...
redarrow Posted June 26, 2007 Share Posted June 26, 2007 <?php $dir_path="pic/"; $dir_name = "cooker"; if(is_dir("$dir_path$dir_name")){ rmdir("$dir_path$dir_name"); } mkdir("$dir_path$dir_name", 0777); if(is_dir("$dir_path$dir_name")){ echo " Dir created $dir_name"; }else{ echo " no directory of $dir_name created"; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.