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 6578513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:46:50+00:00 2026-05-25T15:46:50+00:00

I use codeigniter. I want multiple upload image, for this work, i use library

  • 0

I use codeigniter. I want multiple upload image, for this work, i use library Multi_upload and jquery.MultiFile.

i have in output, this Array ( [0] => [1] => [2] => ) no => this is is from line 18 (print_r($error);echo 'no';) in the my code, and inserted to databse table this: [](i want insert file name) . how can fix it?

My Html: http://pastebin.com/8YWJS2hy

library Multi_upload: http://pastebin.com/115ASstV

jquery.MultiFile: http://pastebin.com/0cyU8HvA

My Controller:

function insert_data(){
    $config['upload_path']   = './uploads/'; // server directory
    $config['allowed_types'] = 'gif|jpg|png';
    $config['max_size']      = '512';

    $this->load->library('Multi_upload');
    $error = array();
    $data  = array();
    for ($i = 0; $i < count($_FILES['userfile']['name']); $i++) {
        $this->upload->initialize($config);
        if (!$this->multi_upload->go_upload('userfile', $i)) {
            $error[] = $this->upload->display_errors();
        }
        $data[$i] = $this->multi_upload->go_upload();
        //gradually build up upload->data()
    }

    if (count($error) > 0) {
        print_r($error); //Line 18
        echo 'no';
    } else {
        print_r($data);
        echo 'ok';
    }

    $data = array(
        //'name' => $this -> input -> post('name'),
        //'term' => $this -> input -> post('term'),
        'image' => json_encode($data)
    );

    $this->db->insert('table', $data);
}
  • 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-25T15:46:50+00:00Added an answer on May 25, 2026 at 3:46 pm

    You should count $_FILES[‘userfile’] , not the name inside.

    Also make sure that at the HTML page sending the request , all file fields are called userfile[] (e.g. )

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

Sidebar

Related Questions

I want use from multiple upload image in codeigniter but problem is here that
I have a dropdown labeled amenities[] and it's an array. When I use CodeIgniter's
I have a CodeIgniter project. I want to use Memcache, but I don't want
So I want to use this plugin http://docs.jquery.com/Plugins/autocomplete I want to retrieve all the
I'm using CodeIgniter, and will likely use their template library as I want to
I'm running a LAMP environment with CodeIgniter. I want to be able to use
should i use Classname() or __construct() as constructor in CodeIgniter? both work, which should
Please help I want to use first URI segment into my CodeIgniter website. Like
I have got a little problem using the CodeIgniter route function. I use the
i use a simple PHP framework (like Codeigniter) without ORM. I have a database

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.