Book Image

Yii Project Blueprints

By : Charles R. Portwood ll
Book Image

Yii Project Blueprints

By: Charles R. Portwood ll

Overview of this book

Table of Contents (15 chapters)
Yii Project Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Uploading files


The final component that we'll be adding to our module is a file manager with file upload capabilities. For this component, we'll be creating a dedicated controller to view all of our uploaded files in paginated format, several new classes to handle the actual file upload, and a few view changes to our content save view so that we can associate files with a particular article.

Rather than bundling all of this functionality into our FileController that we'll be building, we'll start by building three different components to handle the various aspects of uploading a file. The first class File will represent a $_FILES['file'] object and will provide the functionality for saving the file. The second class, FileUpload, will be our call point for uploading our file and will return the appropriate database to us. The final class, FileUploader, will handle the interactions between the File and FileUpload class. These three classes will ensure that our FileController class is clean...