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

  • SEARCH
  • Home
  • 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 7008065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:41:15+00:00 2026-05-27T21:41:15+00:00

I have been stuck at this point for a long time and even after

  • 0

I have been stuck at this point for a long time and even after reading a number of posts, I haven’t been able to find a solution.

I am making an interface for a quiz, and in the admin interface, I need to upload images to a folder and upload the image name to the database. I can handle to other things but the image upload is bugging me alot for a long time.

Please take a look at my code below.

The Form

<?php echo form_open_multipart('admin/update_question'); ?>
<?php echo form_hidden('questionid', $question->level); ?>
<?php echo form_label('Comment', 'comment'); ?>
<div class="input">
<?php
    $arr_comment = array(
        'name'  => 'comment',
        'id'    => 'comment',
        'value' => $question->comment
        );
        echo form_textarea($arr_comment);
?>
</div>
<br/>
<?php echo form_label('Answer', 'answer'); ?>
<div class="input">
<?php
    $arr_answer = array(
            'name'  => 'answer',
            'id'    => 'answer',
            'size'  => '10000',
            'value' => $question->answer
    );
    echo form_input($arr_answer);
?>
</div>
<br/>
<?php echo form_label('Image', 'userfile'); ?>
<div class="input">
<?php
    $arr_image = array(
        'name'  => 'userfile',
        'id'  => 'userfile',
        'value' => ''
    );
    echo form_upload($arr_image);
?>
</div>
<br/>
<?php
$arr_button = array(
    'name'  => 'submit',
    'value' => 'Update Question',
    'class' => 'btn primary large'
    );
?>
<div class="input">
<?php echo form_submit($arr_button); ?>
</div>
<br/>
<?php
echo form_close();
if ($error != '')
    echo '<div class="alert-message error">'. $error.' </div>';
echo validation_errors();
?>

I have tried running a js which returns the filename in the upload box, and it does return it.

The Controller

public function update_question() {
        $comment = $this->input->post('comment');
        $answer = $this->input->post('answer');

        echo var_dump(is_dir(base_url().'uploads/'));

        /*
         * Uploading image
         */
        $config['upload_path'] = base_url().'/uploads/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_width'] = 0;
        $config['max_height'] = 0;
        $config['max_size'] = 0;
        $config['encrypt_name'] = TRUE;

        $this->load->library('upload', $config);
        if ( ! $this->upload->do_upload())
        {
                $error = array('error' => $this->upload->display_errors());
                print_r($error);
        }
        else
        {
                $arr_image = array('upload_data' => $this->upload->data());
                print_r($arr_image);
        }

        $questionid = $this->input->post('questionid');
        $question_data = array(
            'comment'   => $comment,
            'answer'    => $answer
        );
        $this->load->model('adminmodel', 'admin');
        $question_data = $this->admin->update_question_data($questionid, $question_data);
        //redirect('admin/questions', 'location');
}

For my upload path, I have tried a number or combinations and the only one which returned a TRUE value was var_dump(is_dir('/wamp/www/quark_edorado/uploads')); but this also returned the same error.

I do not know where I am going wrong.

Update

My directory structure is

/application/
/public/
    css/
    fonts/
    images/
    js/
/system/
/uploads/

I am operating a Windows machine and using WAMP. Does that make a difference?

  • 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-05-27T21:41:16+00:00Added an answer on May 27, 2026 at 9:41 pm

    I was autoloading the library and somehow when I was trying to initialize the configuration by $this->load->library('upload', $config); it wouldn’t do so.

    Instead I put my config files in config/upload.php

    The other method to do so would have been $this->upload->initialize($config);

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

Sidebar

Related Questions

I have been stuck for a long time on this simple but obtuse message
I have now been stuck at this for some time so I though to
I have been stuck for so long on this and just can not get
I have been stuck on this for days, and was wondering if anyone had
I have been stuck on this for a while. i have tried and I
I have been stuck on this and don't really know how to go about
I have been stuck on this silly if statement, whatever i do, I cannot
so i have been stuck with this issue for 3 weeks now and i
i know this is basic but somehow i have been stuck here for some
Hope to get solution to this problem. I have been stuck on it since

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.