ibanez270dx Posted August 28, 2006 Share Posted August 28, 2006 Hi, I need to make a script to display the subfolders of a network directory (for example, \\network\users$\ ) ... I don't think I'm using the dir function correctly, and I don't exactly understand how it works from php.net... can someone help me out? Thanks, - Jeff Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted August 28, 2006 Share Posted August 28, 2006 Here is a function that will do what you want:http://us2.php.net/manual/en/function.readdir.php#64613Make sure that the directory has the correct permissions for the web server user to be able to read from it. For example, I have a script that does the same thing on an IIS6 server...reads the files in a directory that is stored on a network share. However, the IUSR_servername user doesn't have permissions on the directory, and can not access it. I have to run that script as my username, because I have permissions on the directory. Quote Link to comment Share on other sites More sharing options...
paruby Posted December 6, 2006 Share Posted December 6, 2006 hitman6003 - Can you tell me how you run the scrpt as your username?Thanx - paruby Quote Link to comment Share on other sites More sharing options...
keeB Posted December 6, 2006 Share Posted December 6, 2006 [code]<?php/** * @author: keeb * @description: return all sub directories from a directory * */function fileTypeFilter($path) { return glob($path . "/*");} function isDirectory($directory) { return is_dir($directory);} $path = "/var/www/audio"; $subfolders = array(); $folders = fileTypeFilter($path); foreach ($folders as $sub) { if (isDirectory($sub)) { array_push ($subfolders, $sub); } } ?>[/code]$subfolders contains a list of the subfolders in the directory.Good luck ;) 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.