CodeIgniter from Scratch: File Uploading and Image Manipulation
videos

CodeIgniter from Scratch: File Uploading and Image Manipulation

This entry is part 9 of 17 in the CodeIgniter From Scratch Session
« PreviousNext »

In lesson nine of our CodeIgniter series, we’ll build a small image gallery that allows you to upload files, and automatically create thumbnails.

Final Example

Catch Up

Day 9: File Uploading and Image Manipulation

Other Viewing Options

Add Comment

Discussion 144 Comments

Comment Page 3 of 3 1 2 3
  1. Lew says:

    After i have chosen file and choose upload a particular image file. It works fine. However, when i refresh the page, the same image will be added to the gallery again. Is there a bug for the source code?

  2. sarmen says:

    @Lew , thats not a bug , the same thing would happen if you were using core php. you need to add code that checks if the submit button was pressed before allowing an upload such as

    if(isset($_POST['btn'])
    {
    //do upload
    }

    when you refresh the last action is executed but when you have a button that needs to be pressed it wont.

  3. Jhonny says:

    this error in my code,

    A PHP Error was encountered

    Severity: Notice

    Message: Undefined property: Gallery_model::$upload

    Filename: models/gallery_model.php

    Line Number: 23

    Fatal error: Call to a member function do_upload() on a non-object in C:\xampp\htdocs\Age\application\models\gallery_model.php on line 23

    line 23//$this->upload->do_upload();

  4. Ellen says:

    Great tutorial, thanks!

    I got it working with one difference:

    I have my images folder in a different location, ie I have
    system/
    application/
    public_html/images/

    I used $this->gallery_path = realpath(FCPATH . ‘/images’);
    (Instead of APPPATH)

  5. Thilak says:

    Great post. Thanks.

  6. Jeff says:

    can anyone help, how can i download file from the server using the codeigniter? plz i need help

Comment Page 3 of 3 1 2 3

Add a Comment

To add a code snippet to your comment, please wrap your code like so: <pre name="code" class="html">YOUR CODE</pre>. You can replace the class name with "js," "css," "sql," or "php." If there are any "<" or ">" within your code, please search and replace them with: &lt; and &gt; respectively.