8.2. Accessing the Uploaded File

File uploads work differently than standard inputs, which means you must handle them a little differently. In this case, you must modify update.inc.php to deal with uploaded images.

You don't want to force your users to upload an image to post a new entry, so you need to check whether a file was uploaded after you verify that the rest of the entry form was filled out. To check whether a file was uploaded, you look in the $_FILES superglobal array.

8.2.1. A Quick Refresher on the $_FILES Superglobal Array

You learned about the $_FILES superglobal in Chapter 3, but it might be helpful to review what it does before moving on.

Whenever a file is uploaded via an HTML form, that file is stored in temporary memory ...

Get PHP for Absolute Beginners 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.