There are a number of ways of allowing a directory to be selected. We could build a tree menu or an icon-based navigation system, like Windows, KDE, Gnome, which is popular in common desktop managers. For the purpose of this chapter, a tree-based solution is too bulky. We will look at how to build a tree-based navigation tree in Chapter 7, Image Manipulation.
In this chapter, we will build a select box that can be used in a form for file selection and uploads. The select box will change dynamically as different options are selected.
To set this up, start by creating a new directory, which is outside of the web root, and make sure it is writeable by the server. For this chapter's example, let's set the directory permissions to be fully open. When putting this directory on a live server, make sure it is tied down to allow just the web server to change its contents.
On my test server, the directory I am testing with is /home/kae/uploaded_files
, and within this directory I...