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 Link to comment https://forums.phpfreaks.com/topic/57145-is-there-a-php-function-that-can-create-folders-in-windows-os/ Share on other sites More sharing options...
per1os Posted June 25, 2007 Share Posted June 25, 2007 http://us2.php.net/mkdir Should work. Link to comment https://forums.phpfreaks.com/topic/57145-is-there-a-php-function-that-can-create-folders-in-windows-os/#findComment-282360 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 Link to comment https://forums.phpfreaks.com/topic/57145-is-there-a-php-function-that-can-create-folders-in-windows-os/#findComment-282385 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 Link to comment https://forums.phpfreaks.com/topic/57145-is-there-a-php-function-that-can-create-folders-in-windows-os/#findComment-282388 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. Link to comment https://forums.phpfreaks.com/topic/57145-is-there-a-php-function-that-can-create-folders-in-windows-os/#findComment-282389 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 Link to comment https://forums.phpfreaks.com/topic/57145-is-there-a-php-function-that-can-create-folders-in-windows-os/#findComment-282393 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. Link to comment https://forums.phpfreaks.com/topic/57145-is-there-a-php-function-that-can-create-folders-in-windows-os/#findComment-282398 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 Link to comment https://forums.phpfreaks.com/topic/57145-is-there-a-php-function-that-can-create-folders-in-windows-os/#findComment-282400 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"; } } } ?> Link to comment https://forums.phpfreaks.com/topic/57145-is-there-a-php-function-that-can-create-folders-in-windows-os/#findComment-282412 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); ?> Link to comment https://forums.phpfreaks.com/topic/57145-is-there-a-php-function-that-can-create-folders-in-windows-os/#findComment-282872 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"; } ?> Link to comment https://forums.phpfreaks.com/topic/57145-is-there-a-php-function-that-can-create-folders-in-windows-os/#findComment-282896 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.