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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:21:06+00:00 2026-05-26T06:21:06+00:00

I want to upload files with CodeIgniter through generated numbered upload fields : <input

  • 0

I want to upload files with CodeIgniter through generated numbered upload fields :

<input type='file' name='field[0]' />
<input type='file' name='field[1]' />

These upload fields are among another inputs fields :

<input type='file' name='field[0]' />
<input type='TEXT' name='field[1]' />
<input type='file' name='field[2]' />

I just want to upload the files when the user click on the Submit button and keep this specific inputs structure

I’ve tried this but it doesn’t work :

     for($i=0; $i<count($_FILES); $i++)
     {

       $config['upload_path']   = './uploads/';
       $config['allowed_types'] = 'jpg|jpeg|gif|png';
       $config['overwrite']     = FALSE;

      $this->upload->initialize($config);
$this->upload->do_upload('field['.$i.']');


     }

Any help would be very appreciated! Thanks!

  • 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-26T06:21:06+00:00Added an answer on May 26, 2026 at 6:21 am

    That did the trick :

    foreach ($_FILES['field']['name'] as $i => $name) { 
    
         if ($_FILES['field']['error'][$i] == 4) { 
             continue;  
         } 
    
         if ($_FILES['field']['error'][$i] == 0) { 
    
              if ($_FILES['field']['size'][$i] > 99439443) { 
                 $message[] = "$name exceeded file limit."; 
                 continue;   
              } 
    
             /* 
              * Check File Extension 
              * Move  File            
              */   
    
                echo $name;
                echo '<br />';
    
                $uploads_dir = $config['upload_path'] = './uploads/thumbs/'.$this->session->userdata('raw_name');
    
                $tmp_name = $_FILES["field"]["tmp_name"][$i];
                $name = $_FILES["field"]["name"][$i];
                move_uploaded_file($tmp_name, "$uploads_dir/$name");        
    
         } 
    }
    

    Unfortunately, not in CodeIgniter way 🙁 It doesn’t work and I don’t know why, but this works well

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

Sidebar

Related Questions

asp.net provides file upload control.... now if i want to upload files on my
I want the users to upload files through my webapp I am developing in
I want to upload files directly to IIS7 (in this case I am using
i want to upload two files. here is the script <? ini_set('memory_limit', 400M); ini_set('file_uploads',
I want to upload some files of size 35MB on to the blob container.
i have the form, and i want to upload two files. here is the
I want to allow users to upload files with transaction information to my application.
I would like to upload files just like google mail does. I would want
I want to upload and store video files to my server using PHP. Could
Let's say I want to allow my developers to upload their war files to

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.