Book Image

CodeIgniter Web Application Blueprints

Book Image

CodeIgniter Web Application Blueprints

Overview of this book

Table of Contents (16 chapters)
CodeIgniter Web Application Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Putting it all together


Let's look at how the user uploads an image. The following is the sequence of events:

  1. CodeIgniter looks in the routes.php config file and finds the following line:

    $route['create'] = "create/index";

    It directs the request to the create controller's index() function.

  2. The index() function loads the create/create.php view file that displays the upload form to the user.

  3. The user clicks on the Choose file button, navigates to the image file they wish to upload, and selects it.

  4. The user presses the Upload button and the form is submitted to the create controller's index() function.

  5. The index() function creates a folder in the main upload directory to store the image in, then does the actual upload.

  6. On a successful upload, index() sends the details of the upload (the new folder name and image name) to the save_image() model function.

  7. The save_model() function also creates a unique code and saves it in the images table along with the folder name and image name passed to it by the...