In this section, we are going to validate the submitted form and make sure that the required fields are present and the submitted file is an image. Then we will upload the image to our server, process the image, create the thumbnail, and save the image information to the database as follows:
photo.phpfile in the
app/models/directory (the model that we generated earlier in this chapter) inside the class definition before the last curly bracket(
//rules of the image upload form public static ...