Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8390245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:55:55+00:00 2026-06-09T18:55:55+00:00

Looking at the example found here in the Codeigniter Users Guide , I’m left

  • 0

Looking at the example found here in the Codeigniter Users Guide, I’m left wondering what calling if( !$this->upload->do_upload() ) from within the do_upload() method itself does.

Here’s a paste of the code direclty.

class Upload extends CI_Controller {

    function __construct() {
        parent::__construct();
    }

    function do_upload() {
        $config['upload_path'] = './uploads/';
        $this->load->library('upload', $config);

    // ** My question starts here **
        if ( !$this->upload->do_upload() ) {
            $error = array('error' => $this->upload->display_errors());
            $this->load->view('upload_form', $error);
        }
        else{
            $data = array('upload_data' => $this->upload->data());
            $this->load->view('upload_success', $data);
        }
    }
}

As I see it, it’s checking the do_upload() method from within do_upload() itself .. am I mistaken?
Forgive my naivety, but I’ve never seen this before .. is it a common practice?
What does it do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:55:57+00:00Added an answer on June 9, 2026 at 6:55 pm
    if ( !$this->upload->do_upload() ) {    
    

    is calling the do_upload function which is in CI’s own upload class.

    The example in the docs isnt the best.

    So it isnt calling do_upload within your controller again, it is calling do_upload in the upload class which does the actual uploading.

    HTH

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Looking through the documentation for Highstocks, I found this example : Shown here is
I am looking at an example found here: http://perlmeme.org/tutorials/sort_function.html And it gives this code
I've been looking into faceted search with Lucene.NET, I've found a brilliant example here
Looking on the internet for C++ brainteasers, I found this example: #include <iostream> using
I've looking for an example for having Log scale, I've found something here: http://blog.dooapp.com/javafx-chart-api-and-logarithmic-scale-tag-ja
I found great examples of what Im looking for here : http://hugoduncan.org/post/2010/shell_scripting_in_clojure_with_pallet.xhtml But seems
I've been looking for an example of characterpickerdialog usage but haven't found any. Would
looking at this example of the jquery ui slider http://jqueryui.com/demos/slider/#steps i want to be
I am using the MWFeedParser (found here: https://github.com/mwaterfall/MWFeedParser ). I followed his example app,
I'm looking for an code example of NTP client write in C. I found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.