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

Creating the controllers


We're going to create two controllers in this project, which are as follows:

  • /path/to/codeigniter/application/controllers/create.php: This handles the creation of unique folders to store images and performs the upload of a file.

  • /path/to/codeigniter/application/controllers/go.php: This fetches the unique code from the database, and returns any image associated with that code.

These are two of our controllers for this project, let's now go ahead and create them.

Create the /path/to/codeigniter/application/controllers/create.php file and add the following code to it:

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Create extends MY_Controller {
  function __construct() {
    parent::__construct();
      $this->load->helper(array('string'));
      $this->load->library('form_validation');
      $this->load->library('image_lib');
      $this->load->model('Image_model');
      $this->form_validation->set_error_delimiters...