You want a way for readers to communicate with you through your web site. This is commonly done through email, but sometimes the visitor may want to send something—a picture or a music file, perhaps. PHP allows you to upload a file through a form and send it to the web server. Let’s take a look at how to do this.
Remember that when using forms you can choose either GET or POST. PHP file uploading works best with POST.
I’ve created the form that allows for selecting a file. This one allows you to select a file from anywhere on your computer, and then it creates a submit button that lets the visitor send the file through the browser. Check out the code that makes this happen, then look at Figure 14.1.