williamrouse Posted May 1, 2009 Report Share Posted May 1, 2009 I want to perform an operation on all files in a given directory. I want the user to choose the directory with some GUI interface. Using HTML I could use the INPUT as I found in this example below at TIZAG. As anyone found a method just to choose a directory? Thanks! WBR http://www.tizag.com/phpT/fileupload.php Choose a file to upload: Quote Link to comment Share on other sites More sharing options...
falkencreative Posted May 1, 2009 Report Share Posted May 1, 2009 Assuming I am understanding you correctly... could you use a instead? You could use readdir() (http://us3.php.net/readdir) to grab the names of all of the files/folders in the directory, and then use is_dir() (http://us3.php.net/manual/en/function.is-dir.php) to check if the name represents a folder. If so, add it to an array, and then echo out that array in the form of a , where each option in the select is a value from the array. So, roughly, you would need to: -- open the directory with opendir () -- read in all of the file names with readdir() -- check through each file name, and if it represents a folder (using is_dir()) add it to an array -- close the directory with closedir() -- loop through the array, echoing out an option for each item in the array Make sense? Quote Link to comment Share on other sites More sharing options...
williamrouse Posted May 1, 2009 Author Report Share Posted May 1, 2009 Yes! Quote Link to comment Share on other sites More sharing options...
jlhaslip Posted May 2, 2009 Report Share Posted May 2, 2009 Be sure to exclude the (.) and (..) directories... else you will be handling the current and parent directories. 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.
Note: Your post will require moderator approval before it will be visible.