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

<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" />
</form>

Is there set directories for uploading, or will folders be added/deleted ect?

Folders will be added, but not deleted.

Member Avatar for 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>
</select>

<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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.