I’m going to begin this chapter by demonstrating how to accept file uploads in your forms. Like handling any HTML form using PHP, the process of uploading a file has two dimensions. First the HTML form must be displayed, with the proper code to allow for file uploads. Then upon submission of the form, the PHP script must copy the uploaded file to the proper location.
However, for this process to work, several things must be in place:
PHP must run with the proper settings.
A temporary storage directory must exist with the proper permissions.
The final storage directory must exist with the proper permissions.
With this in mind, I’ll first adjust the server to ensure that file uploads are allowed. Then I’ll create the upload ...