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?


<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
7 Years
Discussion Span
Last Post by diafol

You want to create folders to upload files to? If so, use a SELECT widget with all the available folders in OPTION tags. Include an INPUT box if you want to create a new upload folder.

The best way to perhaps is to include two radio buttons:

... start form ...

<label for = "oldfolder"><input type = "radio" id="oldfolder" name="folderselect" checked="checked" /> existing folder</label>
<select id="useoldfolder" name="useoldfolder">
   <option value="...">...filled from php function to list all folders ...</option>

<label for = "newfolder"><input type = "radio" id="newfolder" name="folderselect" /> new folder</label>
<input type="text" id="addnewfolder" name="addnewfolder"  />

... rest of form ...

The destination folder can then be taken from the $_POST variables.

Sorry if this ain't what you're looking for. If it is, you may want to include som client-side (js) validation for folder names (no funny symbols). In addition your server-side validation should check that the folder doesn't already exist. BTW this is a very simple e.g. and will only create 'top-level' document folders, not sub-folders of exisiting document folders. JS can be included to enable/disable the SELECT or INPUT widgets on radio checking.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.