Managing Files

The final segment of this Web application will manage files of any type. These scripts will allow users to upload files from their computers, which will then be stored on the server. The concept behind managing file uploads—as well as the very, very important preparation steps—was discussed in Chapter 11, “Extended Topics.” This application will expand upon that basic demonstration by

  • Storing the file’s information in the database

  • Renaming the file

  • Providing a method of downloading the files

  • Placing the files outside of the Web root directory, for improved security

In order to use these scripts, you’ll need to do two things. First, create the uploads table (if you haven’t already), using this SQL command (Figure 12.21).

Figure 12.21. ...

Get PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.